AnsweredAssumed Answered

Can someone explain the architecture of FM 12 Pro - Starter Solutions

Question asked by tlawson on Dec 15, 2012
Latest reply on Dec 15, 2012 by davidanders


Can someone explain the architecture of FM 12 Pro - Starter Solutions


     I am new to FM.  I've been going through the "Starter Solutions" given to create a new system.

     Each of the start solutions that has more than one table is using a similar architecture which I understand in concept but not in implementation.

     The each make use of a primary key called "XXX ID MATCH FIELD" in the main table of that particular app.  For instance:

     In the"Event Management" starter solution, this field is "EVENT ID MATCH FIELD".  This field is used to match records from associated files like "Contributors", Tasks", "Guests", "Agenda".  Each of these associated tables (1-to-many) has it's own primary key but is each connected through a many-to-1 relationship with the "Event" table.  This allows the user to see all the "Agenda" items for a particular event, all the Tasks items for a particular event.

     The relationship is fairly easy to understand if a record for an associated table (Agenda for instance) is created using a portal.  The foreign key ("EVENT ID MATCH FIELD") get filled in automatically.  Where I'm a little confused is this:

     Let's use the "Agenda" table for this example:  The "EVENT ID MATCH FIELD" is set to Auto-Enter as a calculated value which refers to a global variable called $$CURRENT_EVENT_ID.  This is where I get lost.  I'm know that global variables are set via scripts but how, when, where.

     WHAT I NEED:  I need to understand how to manage these global variables.  How do I set them?  When do I set them? Where do I set them from?

     The script is very simple but when and how do I call it.  I'd assume that I call it when a new "Event" record is created (trigger off the layout triggers - OnRecordLoad, OnLayoutEnter???).  I expected the OnRecordLoad to set the global variable $$CURRENT_EVENT_ID, but it doesn't.  Why not?  When does it get set?

     Is this is the only place I'd set the global variable?  Would I tie the trigger to a button that created a new "Event"  as opposed to using a portal?  

     The scripts used for each of starter solutions also use a global variable called $$SCRIPT_TRIGGER.  What's it's function?

     This question is already too long.  What I'm trying to understand is how to manage a global variable that ties different tables together.