3 Replies Latest reply on Jun 17, 2013 2:42 PM by philmodjunk

    Script problem with variable



      Script problem with variable


           FM 12 script picture attached.

           I have a script that creates a (Referral) record. It works, a record is created with the fields, except that the variable $$vjobid does not get into the record: when I perform the script 3 times, I get 3 different values in FKJobID, none of which is in $$vjobid..

           The real puzzler is that I inserted a Show Dialog and the message shows the correct value all 3 times in $$vjobid, and yet the next Set Field step inserts something different into FKJobID.


           Any bright ideas?


        • 1. Re: Script problem with variable

               Might there be an auto-enter field option specified for FKJobID?

               an auto-enter calculation could modify the value entered into the field by the script.

               Is there a script trigger specified for the Insert Current Date field?

               THe insert step (which could be replaced by set field using the get ( currentDate ) function, can trip an OnObjectEnter, OnobjectExit or OnObject save trigger. (OnObjectExit would be tripped on the filed that has the focus prior to this step being executed.)

               Is this the entire script or a portion of it?

               YOu might put a pause/resume immediately after the set field step to see if it is getting the expected value or not as a way to narrow this down. If you Have FileMaker Advanced, run this script in the debugger with the data viewer up to watch the values in variables and fields change step by step to see where this goes wrong for you.

          • 2. Re: Script problem with variable

                 Indeed the field had been set to auto-enter, Lookup.

                 It still didn't work so I also changed the Strict validation and turned off Numeric Only.

                 Then it worked!!

                 Not sure why as the values were all numeric, but ecstatic to finally get that working!

                 Thank you!

            • 3. Re: Script problem with variable

                   You might be able to re-enable the Numeric Only validation and use GetAsNumber ( $$vjobid )