1 Reply Latest reply on Jul 25, 2014 11:13 AM by philmodjunk

    Single script to feed different multiple fields

    FrancoT

      Title

      Single script to feed different multiple fields

      Post

           We have a script dedicated to write data in the rows of a certain specific multiple field, playing with the programmable flag available on the set field selection mask.

           Since other multiple fields would require to be fed by the same script - final target would be to assign such script to a trigger identically to all - is it possible to define parametrically the multiple field names and be able to set with a calculation the row number on which go to write data?

           thankyou in advance for any help an suggestion

            

            

            

            

        • 1. Re: Single script to feed different multiple fields
          philmodjunk
               

                    playing with the programmable flag available on the set field selection mask.

               I've been using FileMaker for over 10 years and know of no such feature in FileMaker. Is this something that you or a third party has produced?

               There are several strategies for passing multiple values, such as multiple field names in a single script parameter:

               One method:

               List ( GetFieldName ( Table::Field1 ) ; GetFieldName ( Table::Field2 ) ; GetFieldName ( Table::Field3 ) )

               passes the Tutorial: What are Table Occurrences?::FieldName references to three fields in a return separated list. (Use GetFieldName so that this updates even if you rename a table occurrence or a field name in Manage | Database at a later point in time.)

               GetValue ( Get ( ScriptParameter ) ; 2 )

               would then extract the 2nd field name from this list.

               Another method:

               "Let ( [ $Variable1 = " & GetFieldName ( Table::Field1 ) & " ; $Variable2 = " & GetFieldName ( Table::Field2 ) & " ] ; 1 )"

               can be passed as a script parameter.

               Then this step:

               Set Variable [$Dummy ; value: Evaluate ( Get ( ScriptParameter ) ) ]

               Assigns the value 1 to $Dummy, but creates two variables, $variable1 and $variable2 with field names assigned to them as a "side effect" of evaluating the expression passed as text in the script parameter.

               I prefer the first method, but it cannot always be used and then I use the second option. (List will drop out null values so if you have a value that is sometimes null, this can keep the first option from working reliably.) With either method, once you have the tableOccurrence::FieldName references passed to your script, GetField can return the contents of the named field and Set Field By Name can be used to modify the contents of such a neamed field.

               

                    to set with a calculation the row number on which go to write data?

               And what "row number" would that be? The row of a portal? The row of a record shown in a table or list view? Or something else?