How to use two different tables to create a record on a third table with a loop

Hello,

I am new to this forum, and still learning the ins and outs of Appsheet. I am wondering if there is a way to use two tables to loop an action on a third table.

For example, I have three tables, a Budget table, a Pillar table, and a "Pillar Budget" table that is the culmination of both. The Budget table will store information such as year and versions for each year . The Pillar table will store the names of all the different Pillars that will be assigned to the said Budget earlier. The Pillar Budget table will basically act to join the two together.

The action I would like to take place is once a new Budget record is created, it will create a new record in the Pillar Budget table for EACH Pillar record available. So if there are 5 different Pillars, once a new Budget year/version is created, it will automatically create 5 rows in the Pillar Budget table with each Pillar assigned.

Assuming we have:

Budget: "2026 V1"

Pillar: "Test Pillar A" "Test Pillar B" "Test Pillar C" "Test Pillar D" "Test Pillar E" 

The outcome is:

Pillar Budget: "2026 V1 - Test Pillar A" "2026 V1 - Test Pillar B" "2026 V1 - Test Pillar C" "2026 V1 - Test Pillar D" "2026 V1 - Test Pillar E" 

Thank you for any help in advance, I haven't been able to find a solution for this type of issue before.

Solved Solved
0 3 113
1 ACCEPTED SOLUTION

It sounds like maybe you might be better served using a ref action to create a record in another table, vs. an actual loop.  You only need to use the looping when you need to do more than one of the same thing; for your situation it sounds like you just need to create one record, which the ref action would allow you to do.

I tried to get a link to the timestamp where I talk about how to create a tertiary table's record - fulfillments.  Check that out, I think it's in line with what you're trying to build out.

The idea being that you don't need the mechanism of looping to make the 3rd layer record, instead you run an action on the 2nd layer that makes the 3rd layer; then you can create an action to "run an action on a set of rows", and run the action on the 2nd layer for each of the 2nd layer records - making a 3rd layer record for each.  (Did that make sense. ๐Ÿ˜ต )

View solution in original post

3 REPLIES 3

You absolutely can, you might try searching for action looping in the community - there's been some good discussions about the various nuances of working from different approaches.

I've also got a few videos that you can watch that will help walk you through:

https://youtu.be/q4xCzxPgbaU

Thank you for the reply! I have watched many of your videos and learned lots.

I guess my problem comes with the action itself. I can't find a way to add the Pillar record ("Test Pillar A") to the already created Pillar Budget record ("2026 V1 -"). My action is that when a new Budget record is added, it will also create a record in the Pillar Budget record, however I can't find a way for the Pillar record to be added into the newly created record if that makes sense. If I get that, I will be able to find a solution for the loop.

Thanks!

It sounds like maybe you might be better served using a ref action to create a record in another table, vs. an actual loop.  You only need to use the looping when you need to do more than one of the same thing; for your situation it sounds like you just need to create one record, which the ref action would allow you to do.

I tried to get a link to the timestamp where I talk about how to create a tertiary table's record - fulfillments.  Check that out, I think it's in line with what you're trying to build out.

The idea being that you don't need the mechanism of looping to make the 3rd layer record, instead you run an action on the 2nd layer that makes the 3rd layer; then you can create an action to "run an action on a set of rows", and run the action on the 2nd layer for each of the 2nd layer records - making a 3rd layer record for each.  (Did that make sense. ๐Ÿ˜ต )

Top Labels in this Space