0

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

null
    • Fred
    • 1 yr ago
    • Reported - view

    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:

    • Fred
    • 1 yr ago
    • Reported - view

    Oops forgot: just extend the variables at top to include the remaining fields and extended the trackingarray to include the new variables. 

    • Web_Namer
    • 1 yr ago
    • Reported - view

    Fred Thank you so much!!! You are very kind!

      • Fred
      • 1 yr ago
      • Reported - view

      webmaster.antonioferriero if it worked for you. please remember to mark the post answered so future searchers can be better informed. :)

      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

      Fred You can mark your post answered? How? I thought this was done by the moderator of this forum? 

      • Web_Namer
      • 1 yr ago
      • Reported - view

      RoSoft_Steven there is a button in bottom side 

      • Mel_Charles
      • 1 yr ago
      • Reported - view

      RoSoft_Steven the button to mark as answered only shows for the originator of the particular post

      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

      Mel Charles and webmaster.antonioferriero

      Thanks guys, and it's only in the Get Help section I see. Never saw that before....

      • Fred
      • 1 yr ago
      • Reported - view

      RoSoft_Steven Since you are more of an answer-er, you've never had to mark a post answered. 🙂

      • Ninox partner
      • RoSoft_Steven.1
      • 1 yr ago
      • Reported - view

      Fred 😂

Content aside

  • Status Answered
  • 1 yr agoLast active
  • 10Replies
  • 134Views
  • 4 Following