People Goal 5 - Extra 1: Choosing a script trigger

Document created by Kedar on Feb 4, 2015Last modified by communitymanager on Mar 6, 2015
Version 5Show Document
  • View in full screen mode


NOTE: this page provides extra information about choosing a script trigger in Goal 5 - Part 3:

Ideally we’d like to address any situation where the records displayed by the Main List layout would not be sorted. Here are the possible circumstances:

 

  • When a user first views a set of records, they are not sorted.

  • When the user performs a find, the resulting found set is not sorted.

  • When the user chooses the Records > Unsort menu command, the found set stops being sorted.

  • When the user does something else to change the found set completely, such as performing Show All Records or Show Omitted Only (note that this doesn’t include Omit Record).

 

There are three script triggers you could use to address these circumstances. They are all associated with layouts:

 

  • OnRecordLoad triggers a script to run whenever a record is made current or is entered.

  • OnModeEnter triggers a script to run after you switch modes (Browse, Find, or Preview) while viewing a given layout. It doesn’t matter whether you switch modes manually or whether it’s done by a script.

  • OnLayoutEnter triggers a script to run after a given layout is loaded (that is, when you change from one layout to another).

 

 

However, only the third trigger is an appropriate choice. Here’s why:

 

While OnRecordLoad would address the sorting problem comprehensively, it’s able to do so because the triggered event happens very frequently. Imagine calling a script every time that a record is made current or is entered — this can seriously impact the performance of your solution. Consequently, this trigger should only be used in combination with thorough testing of your solution’s current performance and with consideration of whether future performance could be affected as your solution adds more data or grows in complexity.

 

The next option, OnModeEnter, could trigger the script whenever the user performs a find. since after a find is performed, FileMaker Pro returns the user to Browse mode. However, the Main List layout isn’t set up for the user to perform finds, so there’s not much to be gained by using this trigger.

 

Finally, OnLayoutEnter could trigger the script whenever the user switches to the Main List layout or refreshes the window while viewing this layout. While this doesn't comprehensively address the circumstances listed above, it’s a step in the right direction.



Attachments

    Outcomes