March 25, 20178 yr Hi, I'm aksing myself how I could make the trigger functionality of the fmstandards package work. When I call the CF TriggersAreActive, I get True(1) as a result (in the Data Viewer or inside a Set Variable script step). When I call TriggersDisable and then TriggersAreActive again, I still get True(1), so Triggers are still active. I could simply use a $$ variable to save the trigger state, but I don't want to, because that can lead to problems using subscripts. What am I missing? Thanks a lot for your help, Gary
March 25, 20178 yr Looks like they use several global variables: $$~TRIGGERS_SCRIPTS, $$~TRIGGERS_DISABLE, and $$~DISABLETRIGGERS You should be seeing those in your data viewer. I don't work with those functions, but I use a similar method.
March 25, 20178 yr Author Yes, I have seen them also, but how did they intend to use it? Anyone from fmstandards listening? Thanks
March 25, 20178 yr 26 minutes ago, gczychi said: Anyone from fmstandards listening? Probably not. Although most of them are members, they come and go as their spare time allows. I sent you a Private Message over 4 hours ago, and I see you haven't read it yet.
March 26, 20178 yr I use those functions in my solutions. I usually just use a script vairable, $triggerStatus, and use a set variable step to call the custom functions. Set Variable $triggerStatus = TriggersDisable, and $triggerStatus = TriggersEnable. Just remember to use the functions before any halt script steps or where necessary in any if statements.
March 26, 20178 yr Petrowsky hangs out on the FileMaker facebook group. Bante frequents community.filemaker.com . It seems like this is explained pretty well here: http://filemakerstandards.org/display/bp/Suppressible+Triggered+Scripts Basically, you set a global variable when you want to suppress triggers. And in your triggered scripts, you put at the top something like: If[$$triggersOFF] Exit Script End If That's really all there is to it.
March 26, 20178 yr Here are two examples of using the FMStandards scheme. One is a script that runs on the script trigger OnRecordLoad. It runs if TriggersAreActive, but exits if not TriggersAreActive. The other is part of a script that creates a new window, but I do not wish the OnRecordLoad script to run; so I disable the triggers before opening the new window, and then re-enable the triggers after going to my target layout.
March 27, 20178 yr On 3/24/2017 at 11:17 PM, gczychi said: When I call the CF TriggersAreActive, I get True(1) as a result (in the Data Viewer or inside a Set Variable script step). When I call TriggersDisable and then TriggersAreActive again, I still get True(1), so Triggers are still active. I could simply use a $$ variable to save the trigger state, but I don't want to, because that can lead to problems using subscripts. Others have commented on the usage of the functions, so I won't repeat that. The behavior of the Triggers* functions you describe sounds like a bug, but I can't reproduce it. Can you post the script where you saw that behavior?
March 29, 20178 yr Author Thanks, Jeremy, 1) Out-of-the-box Standards.fmp12 file from Standards 2) Data Viewer «TriggersAreActive»; result 1 3) Data Viewer «TriggersDisable»; result 0 (see screen shot) 4) Data Viewer «TriggersAreActive»; result 1 Gary
March 29, 20178 yr TriggersDisable is designed to be called by a script. It won't disable triggers without a script running to help developers avoid shooting themselves in the foot. What you're seeing in the Data Viewer is how it's designed to work.
March 30, 20178 yr Author Oops… Thanks for the explanation. It's my habit of testing everything in the data Viewer before copying it into the scripts — saves me a bit of work during debugging. Thanks so much, Gary
Create an account or sign in to comment