Validating data in a table

Home Forum General Validating data in a table

This topic contains 5 replies, has 0 voices, and was last updated by  pmeidinger 8 years, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #542

    pmeidinger
    Participant

    I have a table in my form with the following columns: Start Date, End Date, Reason, and Units. The user enters as many rows as they need then press a button on the form that uses a connection action to send the data to the database

    Before this data is sent, I want to be sure that no rows have a Start Date that is after the End Date, and the Units column is greater than zero.

    I know I can use the Set Table Rows to move through the rows and use simple or multiple branches to check the data, but how do I know when I’m at the last row and determined that the data in all the rows is valid?

    Here’s a screenshot of how I’m looping through the rows and checking the data. Where do I determine that I’m at the last row and can submit the data?

    imgur.com/J21QW.png

    #5375

    tmrhymer
    Participant

    After your “Move to next row” you will need a simple branch that checks if the last behavior was successful dl.dropbox.com/u/883792/loop.png. If your loop is on the last row and you try to move to the next row that behavior will fail and this simple branch will catch that. It has to be done immediately after the “Move to next row”. Also just checking, prior to your “Move to next row” you are setting the current row of the table to the first correct?

    #5379

    pmeidinger
    Participant

    That worked, thank you! And yes, I am setting the current row to the first row to begin with. I have a question about that, in fact. Is there a simpler way of doing this instead of doing 1) Set Table Rows:First Row 2) Checking the columns 3) Set Table:Next Row 4) Checking the columns 5) Repeat at 3).

    Here’s the screenshot of what I have. The 1 and 2 labels are the exact same validations, once for the first row and then again for the remaining rows. I wasn’t sure if there was a better way to do this.

    #5380

    tmrhymer
    Participant

    You shouldn’t need two separate commands for validation. I don’t see a link for your screenshot, but if I understand correctly you could do this with just one.

    1) Set Table Rows: First Row

    2) Checking the current row

    3) Set Table: Next Row

    4) Simple branch: Last Behavior Successful? If true go back to 2) if not exit the loop.

    #5381

    pmeidinger
    Participant

    Sorry, here’s that link: imgur.com/utKoN.png. I think I get what you’re saying, though. Will give that a try. Thanks for all your help!

    #5383

    pmeidinger
    Participant

    Your suggestion worked. Thanks, again!

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.