PerfectForms Forums » General

Validating data in a table

(6 posts)
  • Started 1 year ago by pmeidinger
  • Latest reply from pmeidinger
  1. pmeidinger
    Member

    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?
    http://imgur.com/J21QW.png

    Posted 1 year ago #
  2. tmrhymer
    Member

    After your "Move to next row" you will need a simple branch that checks if the last behavior was successful http://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?

    Posted 1 year ago #
  3. pmeidinger
    Member

    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.

    Posted 1 year ago #
  4. tmrhymer
    Member

    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.

    Posted 1 year ago #
  5. pmeidinger
    Member

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

    Posted 1 year ago #
  6. pmeidinger
    Member

    Your suggestion worked. Thanks, again!

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in or register to post.

Contact

1917 Palomar Oaks Way
Suite 160
Carlsbad, CA 92008
866.900.8588

  picture  picture  picture  picture