7 Replies Latest reply on Jan 30, 2009 2:55 PM by TSGal

    variable empty/blank on first run

    sq

      Summary

      variable empty/blank on first run

      Description of the issue

       FileMaker Product(s) involved:FileMaker Pro Adv 10.0v1 Operating System(s) involved:Mac 10.5.5 Detailed description of the issue:I have a script that is called using a parameter.  The parameter is then set to a variable.The first time I open the window and click a pull-down that runs a script trigger OnObjectModify and watching the data viewer the $x variable does not show and the script does not run properly.Run again and the $x variable does show in the data viewer and the script runs fine.  Exact steps to reproduce the issue: 1.  Run a script to go open a new window 2.  have a pull-down that is a global field that runs a script trigger OnObjectModify and pass a parameter. 3.  In the script, Set Variable [$x ; Get(ScriptParameter)] 4.  Select the pull-down and watch the data viewer. Expected Result:Set Variable should work show the value every time.  Actual Result:Set Variable does not get set on first run of script when just going to a new window.  Exact text of any error message(s) that appeared:N/A Any additional configuration information/troubleshooting that is relevant to the issue:none  Any workarounds that you have found:none 

        • 1. Re: variable empty/blank on first run
          TSGal

          sq:

           

          Thank you for your post.

           

          The modified value will not show the first time, because there was nothing to evaluate.  Perhaps you meant to use OnObjectSave.  This will then display the new value; not the modified value.

           

          TSGal

          FileMaker, Inc. 

          • 2. Re: variable empty/blank on first run
            sq
              

            you misunderstand.  if there was nothing to evaluate then the OnObjectModify would not run.

             

            by selecting an item from the pop-up menu the global field is modified.

            that is why the trigger OnObjectModify runs the script. 

             

            i am using it for a search just like the example given at the end of script trigger part 1 video posted on filemaker's website. but instead I use is a pop-up menu.

            • 3. Re: variable empty/blank on first run
              TSGal

              sq:

               

              Thanks for the heads up.  However, the OnObjectModify with a pop-up menu seems to work differently.  I'll forward that information to the appropriate departments.  In the mean time, use OnObjectSave with a pop-up.

               

              Here's a simple test.

               

              Create a field with a value list with three values

               

              1

              2

              3

               

              Create a script that does the following:

               

              Set Variable [ $x ; Get (ScriptParameter) ]

              Show Custom Dialog [ "TEST" ; "The value is " & $x ]

               

              Attach this script to your existing script trigger.  Select "1" and you will have no value.  Select "2", and you will get the message "The value is 1".

               

              Change this to OnObjectSave and it works correctly.

               

              TSGal

              FileMaker, Inc. 

              • 4. Re: variable empty/blank on first run
                TSGal

                Strike that.

                 

                It seems to be working fine.  I was actually passing a parameter with a calculation.  If I pass the field name and then do the calculation into the variable, it works fine.  That is, the example I gave you should work fine.  Sorry for the confusion.

                 

                Let me know exactly what is the parameter you are passing, and what is the value list.

                 

                TSGal

                FileMaker, Inc. 

                • 5. Re: variable empty/blank on first run
                  sq
                    

                  thanks for the fast response and the work around!

                   

                  this is a bug.  the OnObjectModify and Set Variable does not work the first time only after opening a New Window. 

                   

                  i am using OnObjectModify with pop-up menu all over and they work fine as long as I don't open a new window and try to set variable. 

                  • 6. Re: variable empty/blank on first run
                    sq
                      

                     

                    yes, I am passing the field name. 

                     

                    The value list which has two values and only the second shown for the pop-menu is:

                    1 Phone

                    2 Email

                    3 Note

                     

                    parameter being passed is: GetAsNumber (Main::gActionSearch)

                     

                    • 7. Re: variable empty/blank on first run
                      TSGal

                      sq:

                       

                      Now, it is not working.

                       

                      Ooops...  I see the problem.  I have one field set up to be OnObjectModify, and another with OnObjectSave.  The OnObjectSave works correctly, the OnObjectModify does not.  My fault.

                       

                      I have reported the information to our Development and Software Quality Assurance (Testing) departments for more information.

                       

                      TSGal

                      FileMaker, Inc.