2 Replies Latest reply on Aug 29, 2014 9:25 AM by JonSatow

    Scripting multiple checklist values



      Scripting multiple checklist values


           I am trying to create a script to check several values in a field displaying check boxes from a value list.  This can be done manually, but when I use the "Set Field" script command I seem only to be able to set one value.  When the script is run, it checks one value but unchecks all the others.

           Is there a way to script the setting of multiple values in one go?

        • 1. Re: Scripting multiple checklist values

               The multiple values you might select by clicking check boxes are stored in the field as a list with a return separating each value.

               Set Field [YourTable::YourCheckBoxField ; List ( "Value1" ; "Value2" ) ]

               will "select" the check boxes for value1 and value2

               Set Field [YourTable::YourCheckBoxField ; List ( YourTable::YourCheckBoxField ; "Value1" ) ]

               will add "value 1" to the list of any values already in the field, thus checking the box for value 1 without clearing any of the others.

               But you don't want to add a value that has already been selected.

               So you check and see if the value has already been selected before adding it:

               If [ Isempty ( FilterValues ( YourTable::YourCheckboxFeild ; "Value1" ) )  // value is not in the list ]
                  Set Field [YourTable::YourCheckBoxField ; List ( YourTable::YourCheckBoxField ; "Value1" ) ]
               End If

          • 2. Re: Scripting multiple checklist values

                 Thanks: exactly what I wanted.