Check if 7 fields have been filled
Hi!
In a table there are 7 fields to fill and 1 button.
The button serves to create a record in a linked table, on this I have no problems.
I would like the button script first to verify that all 7 fields have been compiled.
If one or more fields have not been filled in I would like to open a popup indicating which fields are empty.
If all 7 fields have been compiled then the script can proceed to create a new record.
I would create a more concatenated if, but I think it is too long and incorrect procedure. What functions should I use to write a clean and simple script?
Thank you so much!
10 replies
-
You can try something like:
#{ These sets of variables are used to test if fields are emtpy then creates an array of the fieldname(s) that are empty. }#; let x1 := if Name = null then "Name" end; let x2 := if SKU = null then "SKU" end; let x3 := if Text = null then "Text" end; let x4 := if Date = null then "Date" end; let x5 := if Number = null then "Number" end; let trackingarray := [x1, x2, x3, x4, x5]; #{ The IF statement checks the count of the trackingarray and if it is not equal to 0 then it, first, loops through the trackingarray to creates a string of text of the field names. Then it replaces the "," in the string with paragraph marks which is just literally just that empty space you see. Then it opens a dialog box informing the user of the empty fields. }#; if count(trackingarray) > 0 then let getfieldnames := for loop1 in trackingarray do loop1 end; let showNames := replace(text(getfieldnames), ",", " "); dialog("Empty Fields", "Please enter in data in the following fields: " + showNames, ["OK"]) else #{here is where you put in your code to create the new record}#; dialog("Completion", "New Record Created", ["OK"]) end
I hope this helps. Of course you need to change the field names to match yours and the dialog text to something that you want.
Here is what it looks like:
-
Oops forgot: just extend the variables at top to include the remaining fields and extended the trackingarray to include the new variables.
-
Fred Thank you so much!!! You are very kind!
Content aside
- Status Answered
- 2 yrs agoLast active
- 10Replies
- 135Views
-
4
Following