Malcolm

FMP12 Script Triggers correct behaviour but do we want it?

Discussion created by Malcolm on May 16, 2012
Latest reply on May 16, 2012 by Malcolm

I have a file which has an OnFirstWindowOpen script. It is two lines:

 

set zoom to 150%

go to layout [mainscreen]

 

The file was closed on a layout which has a script trigger OnRecordLoad. It has one line:

 

go to layout[by name calculation]

 

When the file is opened there are two script triggers activated: OnRecordLoad and OnFirstWindowOpen.

 

This is what happens:

  1. [onFirstWindowOpen script is triggered]
  2. [OnRecordLoad script is triggered]
  3. zoom is set
  4. layout is switched
  5. [onFirstWindowOpen script is complete]
  6. Error occurs because the OnRecordLoad script is being run in the wrong context.

 

The documents clearly state that: when multiple script triggers are activated by the same action, the script triggers activate in the following relative order: 1. OnFirstWindowOpen 2. OnWindowOpen 3. OnLayoutEnter 4. OnModeEnter 5. OnRecordLoad , etc

 

OnWindowLoad has changed the context and turned the onRecordLoad script into a loose cannon. The record that triggered the script is from a different TO. The record receiving the onRecordLoad script has no idea what is happening.

 

The attached file shows the problem clearly. Instead of tidying up data in a utility table the script destroys data in another table.

Attachments

Outcomes