Hey All! Appreciate the great community here.
I am following @MultiTech's YouTube video "Looping with Actions (Do-While & For Loops in AppSheet) | BUILD VIDEO"
I find the solution to looping very elegant. I have attempted to follow the video to incorporate this into an app I am building for my girlfriends food selling business. I have everything working except that it only runs the loop once. I think I know why.
I am attempting to add a single row on my Orders table (these are the individual food items that she needs to make/deliver) for each Invoice Line Item that is a child to (a part of) Invoices. The common data from an Invoice (order date, client, source) are added to each new Table row, and then I add the first (using Index) Invoice Line Item to the Table row, then try to loop through using your method of list subtraction. The hope is that the Invoice is broken down into individual Order rows so that she can check them off as she makes or delivers them.
Because all of my loop actions reside on the Invoice table, the loop action sees only a single record on the Invoice table (even though there are multiple Invoice Line Items under that Invoice record ), even when I set the Reference Rows to the Related Invoice Line Items column that is auto populated on the Invoice table. I expected the list I referenced to be seen as the set of rows to have an action performed on it but it seems like the “Action on a set of rows” will not use a set of rows that is one level removed from the table that the action lives. Here are photos of my Reference Row and the resulting Table data.
Here is a photo of the Table data from the sample app demonstrated in the video where the “Action on a set of rows” would perform. I see clearly multiple rows that would then run the loop this many times.
Expression Results from the YouTube video tutorial
Can I change my reference somehow to generate a list of rows based on the Invoice Line Items so that the loop would function that many times?
Make sense? I wonder of there is a way to reference the child set somehow rather than only the sets living on the Invoice table directly? Thanks for any response!
PS Here are my Invoice and Invoice Line Item data sets.
You need to have a list of pending things in just a single column, which is a virtual column.
Then you apply the loop inside the same row, for the remaining values of the virtual column.
I feel like you are mixing the things a little. I don't know if looping is the best way or not
Thanks for your response.
@SkrOYC wrote:You need to have a list of pending things in just a single column, which is a virtual column.
Isn't that what I have with Related Invoice Line Item? A virtual column, a list that I apply the loop on? But for some reason, the system sees it as not a set of rows but a list of items. The loop works on a "set of rows" but how do I reference that "set", if not through a list?
@feenyjamie wrote:
The loop works on a "set of rows"
Loops work with three lists in my experience, rows or not.
A list of all the ones you need.
A list of all the ones already created.
The list substraction of the two to have a list of pending items. This can generally be just inside expressions, no need for a virtual column
User | Count |
---|---|
19 | |
10 | |
7 | |
5 | |
5 |