1 2 Previous Next 23 Replies Latest reply on Dec 8, 2012 5:51 PM by BruceRobertson

    Script Parameters not reading

    SteveNoble

      I created a script that uses script parameter and is triggered with a script triggered. The script parameters are not being read. See enclosed data viewer.

       

      I have tried OnObjectValidate and OnObjectSave with the same results.

       

      Am I missing something here or do script triggers not read script parameters?

        • 1. Re: Script Parameters not reading
          DavidJondreau

          It's unclear from your screen shots what your parameter is. Post a screen shot that shows the full width of the Set Script Triggers dialog box and there may be something there to diagnose.

          • 2. Re: Script Parameters not reading
            SteveNoble

            I triedseveral parameters 1 and 2 and Get(repititionnumber). None showed upScreen Shot 2012-11-30 at 12.48.46 PM.png

            • 3. Re: Script Parameters not reading
              taylorsharpe

              First, let me assure you that fired script triggers use the script parameter you input when selecting the script to run upon firing of the script trigger.  So that is not an issue. There has to be something in the way you are setting up the Script Trigger.  First of all, I am assuming you have tested things with Script Debugger to assure the script is firing when you expect?  Are there multiple script triggers on this field?  I think your first picture was showing testing of the value of the script parameter in the data viewer, I assume while debugging the script.  Right?  Would you mind sharing a screen shot of your script if it is not too long?  If you want, I can email you a file with a script trigger on validation that grabs the script parameter.  Let me know if that would help. 

              • 4. Re: Script Parameters not reading
                DavidJondreau

                It would be helpful if you could post a screen shot that shows the full width of the Set Script Triggers dialog box. This screen shot is of the Manage Script dialog box.

                 

                It would also be helpful to see a screen shot of the Script Debugger with the script running, but at the very end of it and the Data Viewer on the Current tab, both in the same shot.

                 

                Get ( RepetitionNumber ) isn't a function. Maybe you mean Get ( CalculationRepetitionNumber )? If so, that won't work for anything on your layout. If you mean Get ( ActiveRepetitionNumber ), then that should return the repetition number that the cursor is in.

                • 5. Re: Script Parameters not reading

                  Hi Steve,

                   

                  Another possibility ... Your second screen shot shows Get(ScriptParameter) as the repetition value.  I would bet that should be normal 1 (since I doubt you are writing to variable repetitions). 

                   

                  Then start script with lines:

                   

                  Set Variable [ $p ; Get ( ScriptParameter ) ]

                   

                  ...  Now run debug ... does $p show your value? If so then it is reaching your and once there, you can use it within your script.  If only used once within the script, you do not need to write it to $p first but I like to because then it is clear in the script that it used a parameter and if the parameter is multiple values then it is easier to parse into multiple variables from there.

                   

                  Please allow editing from iPad ... Correction on the post to say "... If so then it is reaching your SCRIPT"

                  • 6. Re: Script Parameters not reading
                    SteveNoble

                    Thanks for everyone help. I do love this community. I will try to explain better.

                     

                    The purpose of the script is to enter data in all related records at the same time with the same data for a single field and again for a second field (different data) and then a third field.

                     

                    I use 3 repeating fields and use script parameters so I have only one script. The script fires ok, the data is copied to all related fields, but always the data from repetition 1 not 2 or 3. If I use a calculation to determine the repetittion or I use 1, 2 or 3 data from repetition is what is copied.

                     

                    David - I stated "Get ( RepetitionNumber )" from memory. In practice I used "Get ( ActiveRepetitionNumber )" But when I used "2" the script copied date from repetition 1(the default)

                     

                    Taylor - Script does fire and only one script trigger I posted the

                     

                    This may work by using 3 seperate fields. So they may be an easier way. But I like to understand why something does not work before I move on.

                     

                    Screen Shot 2012-12-01 at 10.57.30 AM.png

                    Screen Shot 2012-12-01 at 10.19.55 AM.png

                    • 7. Re: Script Parameters not reading
                      SteveNoble

                      David here is the debugger/data viewer Screen Shot 2012-12-01 at 11.05.29 AM.png

                       

                      Notice the value for rep [2} is 87, however the $$qty[2] is 50 which if the value for rep 1

                      • 8. Re: Script Parameters not reading
                        RubenVanDenBoogaard

                        Hi Steve,

                         

                        use

                        'Set Variable [$$gty(Get (ScriptParameter )]; Value:DEL::QtyPerPackage[Get ( ScripParameter )]

                         

                         

                        in the second line to get the second rep in the $$qty[2]

                         

                        Best regards,

                         

                        Ruben van den Boogaard

                        Infomatics Software

                        ruben@infomatics.nl

                         

                         

                        created by SteveNoble in General - View the full discussion

                        David here is the debugger/data viewer https://fmdev.filemaker.com/servlet/JiveServlet/downloadImage/2-101866-3036/351-600/ScreenShot2012-12-01at11.05.29+AM.png

                         

                         

                        Notice the value for rep [2} is 87, however the $$qty[2] is 50 which if the value for rep 1

                         

                        Reply to this message by replying to this email -or- go to the message on FileMaker Technical Network

                        Start a new discussion in General by email or at FileMaker Technical Network

                        Manage your email preferences.

                         

                        FileMaker Developer Conference 2013 • San Diego, California • August 12-15 • www.filemaker.com/devcon

                        • 9. Re: Script Parameters not reading
                          reelsteve

                          Just for a quick check, try

                          GetAsNumber(Get(ScriptParameter))

                          In the repetition field.

                          • 10. Re: Script Parameters not reading
                            reelsteve

                            One other possibility, a needed extend function to provide the non repeating field access to the 2 and 3rd repetition values.  Extend allows the value of a non-repeating field to be used with every repetition of a repeating field. Without this function, the value of the non-repeating field would only be used with the first repetition of a repeating field when evaluating the two fields in the same calculation.

                             

                            Hope one of these gets u 1/4 of the way home !

                            • 11. Re: Script Parameters not reading

                              Steve, we could be at this all day.  Is it not easier to attach your file?

                              • 12. Re: Script Parameters not reading
                                SteveNoble

                                I tried this and it broke the whole thing.

                                • 13. Re: Script Parameters not reading
                                  SteveNoble

                                  I will try this tomorrow when I get back to the office

                                  • 14. Re: Script Parameters not reading
                                    SteveNoble

                                    This is my working fie although this part is all new fields and records. As soon as I can clone and strip other parts out I will post. Thanks

                                    1 2 Previous Next