Update multiple rows in DB table from rows in Table object

Home Forum General Update multiple rows in DB table from rows in Table object

Tagged: , ,

This topic contains 1 reply, has 0 voices, and was last updated by  pmeidinger 7 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #811

    pmeidinger
    Participant

    I have a database table with three fields: ID (unique), Name, Phone. I also have a Table object in my form with these same fields. Assume that the database table has five rows with IDs 1 through 5.

    I want to update those five rows using my Table object. I added five rows to the Table object with IDs 1 through 5, and added name and phone data. How do I update all five rows in my database with the five rows in the Table object?

    I tried the creating an UPDATE database connection action and used the ID column as the Send Condition Parameters and Name and Phone as the Send Value Parameters. In my form, I added a Connect behavior, and used the “all rows” values from my table for the connection parameters. The problem is that only the first row in the Table object is updated in the database. What step am I missing?

    #5828

    Anonymous

    Had an issue with the same thing. Connecting with “all rows” doesnt work – you have to use a behavior that moves through the table and connects/updates each time you have a record on a given row.

    There are a few actions within the behavior you will need to get it moving:

    * Set table row

    * Simple branch

    * connect

    You will need to create a sort of “if statement” loop where you first set the table row to “move to first row”, connect and update the record (for the current row), set table row to next row, do a simple branch with an advance formula “last behavior was successful” – if true, the connector should go back to the connection/update action. If false, close, submit or whatever you need it to do.

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

You must be logged in to reply to this topic.