How do I write an Action that adds a few rows to a table?

Hello community.

Here I am bothering again, since my fluency in Escel does not help me in Appsheet. I have two tables in a parent- child relation. In the first I have an Id_Project as key and a Project Name as label. In the second I have a series of rows with colors names and numbers related to the Id_Project, as I am trying to match a secondary or tertiary color starting with some basic colors. The one-day-to-be app is supposed to aid me keep record of the matching and then the mixing process.

Let us say, I need to match a dark brown color. So I might start with 10 grams of black, 4 grams of yellow and two of red. After looking at it closely I decide to add one gram of white to make it a litlle grayish, so now it is 10-4-2-1. It looks promising now, so I take a sample out of the cup and smear it onto a card made for that purpose or hold it against the surface with the color I want to match. If it is OK, then I will be happy and maximize the formula to a 5 gallons / 19 liter size. If not, I have to keep adding shots of paint from the same colors or even different ones. But now since I cannot return the amount of paint I used in the sampling step, I have to take the weight of what is left and adjust alll of the numbers down accordingly before adding again. Let's say, the weight after sampling is 16.5 grams, instead of the initial 17. That means I lost 2.94 % of all colors.

I suspect what I need is a loop that keeps adding rows to the child table until all colors are adjusted. Something like this (what I have vs what I need): 

 

CorneliusH_1-1718139402072.png

Any sugestions?

Cornelius


Solved Solved
0 2 256
1 ACCEPTED SOLUTION

If you want to create a loop in AppSheet, there are two ways to do it. My preferred method involves using a counter, but it isn't the most optimal or native approach.

Here are the steps you can follow:

1. **Action 1:**
- Add a row to another table using values from this Row.
- Configure the columns to be added.

2. **Action 2:**
- Set values in this row.
- Decrement the counter: `counter = counter - 1`.

3. **Action 3:**
- Execute an action on a set of rows within the same table.
- Referenced action: **Action 4**
- Ensure it only runs if the counter is greater than zero.

4. **Action 4:**
- Execute a sequence of actions: 1, 2, 3.

Using a bot, you can simply execute **Action 4** to initiate the loop.

---

View solution in original post

2 REPLIES 2

If you want to create a loop in AppSheet, there are two ways to do it. My preferred method involves using a counter, but it isn't the most optimal or native approach.

Here are the steps you can follow:

1. **Action 1:**
- Add a row to another table using values from this Row.
- Configure the columns to be added.

2. **Action 2:**
- Set values in this row.
- Decrement the counter: `counter = counter - 1`.

3. **Action 3:**
- Execute an action on a set of rows within the same table.
- Referenced action: **Action 4**
- Ensure it only runs if the counter is greater than zero.

4. **Action 4:**
- Execute a sequence of actions: 1, 2, 3.

Using a bot, you can simply execute **Action 4** to initiate the loop.

---

Hello, I have used this method and it worked well for a while, but now I have the problem of the 120-second execution time limit. What is the second option to achieve a similar action to add many rows to a second table? Have you had a solution for this? Thank you very much.

Top Labels in this Space