4 Replies Latest reply on Apr 2, 2013 10:20 PM by silverbasil

    Auto complete multiple fields

    silverbasil

      Title

      Auto complete multiple fields

      Post

           I have created a database with 17separate fileds  for the description of wall motion.  These are popultated via a value list which contains six variables.  The most common value for these fields is normal.

           To simplifiy the data entry process i would like a field or button to select as "all normal" , this would then populate all the 17 fields with the value"normal".  If the "all normal" is not selkected then i would like to individually poluate the 17 fields with the appropriatte descriptoe from the drop down value list.

            

            

           Any assistance would be apprecitated.

            

        • 1. Re: Auto complete multiple fields
          philmodjunk

               "17 separate fields" might be better off as "17 related records"--one for each field.

               Using your current design, you simply need 17 set field steps to assign "normal" to each field in turn. Then your button on your layout performs this script.

               The script will look like:

               Set Field [YourTable::motionField1 ; "normal" ]
               Set Field [YourTable::motionField2 ; "normal" ]

               and so forth for all 17 fields.

               If your field names are identical except for a number such as I used in my example, you can also use set field by name in a loop to do the same thing:

               Loop
                  Set Variable [$K ; Value: $K + 1 ]
                  Exit Loop If [$K > 17 ]
                  Set Field By name [ "YourTable::motionField" & $K ; "normal" ]
               End Loop

          • 2. Re: Auto complete multiple fields
            silverbasil

                 Thank you.

                 The first approach is fine.  I wanted the wall motion field to be a radio button or checkbox style.  It doesnt seem to work for this control type.  For an edit box or drop down control type  the script works fine.

                  

                 Any suggestions??Many thanks

                  

                  

            • 3. Re: Auto complete multiple fields
              philmodjunk

                   You need to explain what you need to happen in more detail. It works exactly the same regardless of control type. A radio button format, by implication, would be for entering a single value into the field and the script should work equally well for it as long as the value entered by the script is exactly the same as the corresponding value in the value list. If it is even one letter different, then the value entered by the script is still entered into the field, but the value list will hide it from view.

                   Checkboxes on the other hand, suggest that you want to be able to select multiple values in the same field. The script I posted will still work, but any previously entered values will be replaced by the single value entered by the script. If you need to add "normal" to the field without overwriting previously selected values and different expression has to be used in the set field step.

              • 4. Re: Auto complete multiple fields
                silverbasil

                     Thnaks for your assistance.  Indeed the fields did not match precisely.  I now have learnt how tro use this very useful function