2 Replies Latest reply on Nov 13, 2012 1:00 PM by BruceHerbach

    Using a Let statement to set field values

    pmconaway

      I have a script that loads records from a temporary table into another table that is used by the app. I have a script step that sets variables that I tempararly use to hold values from the temp table. In my current script, I have a separate "set field" script step for each field that needs a value. My question is that can I make this another single script that sets the values in the appropriate fields.

       

       

      Paul

        • 1. Re: Using a Let statement to set field values
          ariley

          You can use set field by name and use variables for your field names and loop through them. I usually collect the fields from a layout that's created for this purpose only. 

           

          Best regards, 

           

          agnes b. riley . filemaker and web development

          FileMaker Business Alliance . FileMaker Technical Network

          www.zerobluetech.com (http://www.zerobluetech.com)

           

           

          T 201-299-6223 (NJ) .

          212-842-8830 (NY)

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

          .

          917-660-7221 (C)

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

           

          FileMaker Certified in 10 and 11

          people + products + events + todos + invoices + documents = productivity

          • 2. Re: Using a Let statement to set field values
            BruceHerbach

            Paul,

             

            There are a few ways to do this. 

             

            1. You can make the variables global by  using $$variable name.  This way the second script will have access to the variables created by the first script.
            2. You can pass the values to the second script by including the variables in the Perform Script script step.  Use the List function List ($one, $two....) in the Perform Script step.  Then use get(scriptparameter) with Getvalue ..  As in Set Variable[$one; GetValue(get(scriptparameter);1)] in th second script repeat this for all Variables.
            3. You can create global fields and put the values in the field in the first script and then use them in the second.

             

            Probably the easiest is option 1. Just make sure you have the variable names match in both scripts.

             

            HTH

            Bruce