1 Reply Latest reply on Jul 10, 2014 8:32 AM by philmodjunk

    Script to check whether fields have values, and then add field name to custom dialog

    nthomas

      Title

      Script to check whether fields have values, and then add field name to custom dialog

      Post

           Hello!

           I'm trying to write a script that will act as a final check before moving our data to the next stage in the process. I want it to check several fields on one table to make sure that they all have data in them, and if one or several do not have the required info, to put the name of those fields in a custom dialog box. So far I have used IF functions and the custom message box, so the box appears when there is a field that is blank, and the box reads: 

           "The following required field is missing data. Please fill in data before starting order. "

           But I want it to show which fields are blank below that. Is there a way to do this? Which scripts and/or calculations should I use?

           Thanks!!

        • 1. Re: Script to check whether fields have values, and then add field name to custom dialog
          philmodjunk

               Let's say that your layout has three fields, Name, Address, State.

               Your script might be set up like this:

               If [Isempty ( Yourtable::Name ) ]
                  Set Variable [ $FieldList ; value: "Name" ]
               End IF
               If [Isempty ( Yourtable::Address ) ]
                  Set Variable [$FieldList ; value: List ( $FieldList ; "Address" ) ]
               End If
               If [IsEmpty ( YourTable::State ) ]
                  Set Variable [$FieldList ; value: List ( $FieldList ; "State" ) ]
               End If
                

               If [Not Isempty ($FieldList ) //there are missing fields]
                  Show Custom Dialog ["The Following Fields are empty" & ¶ & $FieldList ]
               End If

               What happens after the custom dialog appears, I leave up to you.