2 Replies Latest reply on Nov 27, 2012 8:33 AM by MilutinPetrovic

    Script to auto fill value list field

    MilutinPetrovic

      Title

      Script to auto fill value list field

      Post

           I've got a tricky one, I tried and I tried, and I get half good results.

           Lets say I have table X with the fields A, B and C. Now I created field D which is a checker box set, value list field with the values 1,2 and 3. So now, I need a script which will check one or more of those values if there is data in fields A,B or C, where 1=A, 2=B and 3=C.

           Thanks.

        • 1. Re: Script to auto fill value list field
          philmodjunk

               Fields formatted with a group of check boxes store their values in the order the corresponding check box was clicked, separated by return characters.

               Set Field [YourTable::CheckboxField ; 1 ]

               will clear all previously selected values and select the checkbox for the value 1.

               Set Field [YourTable::CheckboxField ; List ( YourTable::CheckboxField ; 1 ) ]

               will select the checkbox for 1 without clearing previously selected values.

               But you could use a calculation for this instead of a script:

               List ( If ( Not IsEmpty ( Field A ) ; 1 ) ; If ( Not IsEmpty ( Field B ) ; 2 ) ; If ( Not Is Empty ( Field C ) ; 3 ) )

               This combines the values 1, 2 and 3 in a list if the corresponding fields are not empty.

               Your check box formatted field can be defined as a calculation field that returns text or you can assign this calculaiton to a text field so that the above expression auto-enters the data.

          • 2. Re: Script to auto fill value list field
            MilutinPetrovic

                 Once again You have proved to be extremely helpful!

                 Thank You so much!

                 Cheers!