4 Replies Latest reply on Jun 25, 2014 8:42 AM by jgill@occu-med.com

    Strange OnTabSwitch Behavior

    jgill@occu-med.com

      I'm running into a very strange issue with the OnTabSwitch scriptTrigger and I'm hoping somebody can clarify its behavior. Here's a link to my post on FMForums if anybody cares[1]

       

      So I'm not sure where exactly to put this as it deals with a Custom Function, but hopefully this is the right place. I've been using the excellent #AssignVariables Custom Function over from FilemakerStandards.org for about a year and half with no issues. Today I tried to implement a script that is taking an enumerated value from a parameter passed on an OnTabSwitch ScriptTrigger and for some reason it is failing, and I have no idea why.

       

      The parameter that is being passed is:

      "$target=" & Quote ( GetValue ( Get ( TriggerTargetPanel ) ; 2 ) ) 

       

      The subsequent script then uses the #AssignVariables CF to assign $variable with the contents of the Script Parameter. The problem is, this is not working. However, when I run the Data Viewer side by side with the Script Debugger, the Database viewer assigns the parameter correctly! I have no idea why the Data Viewer would work and the script fails...

       

      Later Edit:

      Ok I just went and simplified the Parameter to 'Get ( TriggerTargetPanel )' and the parameter STILL doesn't pass? Is this a bug? Let me explain in a little more detail how I'm calling this.

      I am controlling a Slide Panel via a Dispatch script and performing checks before allowing a user to progress through a pre-defined process. If the validation passes, then the user is allowed to navigate to their selection, if the validation fails, then the user is presented with a dialog window. I apologize for the bad syntax as AFAIK there's no way to copy and paste script steps into this forum.

       

      If[#AssignVariables ( Get ( ScriptResult ) ) If ( $ScriptResult = True ) Set Script Animation [On] Go to Object [Object Name: $destinationSlideControl] Refresh Window[] Else Show Custom Dialog [$failureTitle;$failureText] Exit Script[Result: 0] End if End If 

       

      The OnTabSwitch SHOULD (IIRC) allow me to pass the name of the tab panel that is specified in the Go to Object Script Step. The Data Viewer confirms that this is happening and correctly assigns the parameter, but the parameter is definitely not passed (returns a False for isValid). Am incorrect in how this works? This honestly feels like a bug...

       

      Edit2: So since this is FM13, I thought it might be a bug with the new Slide Controls, I added a tab panel and tried this. Same results. This time I tried passing the name of both the TriggerCurrentPanel AND the TriggerTargetPanel as parameters and got the same result. The Data Viewer captures the values and assigned them correctly whereas the Script returns a blank result. Am I nuts?