sheet_details saving only after mainsheet runs LOOP - Help!

Okay, so this is something way out of my depth within appsheet.

I have a main sheet for sales, and a sheet_details for the products within the sale.

The problem i'm encountering is that for the TOTAL of the SALE sheet, I get values from the same Id in the SALE_DETAILS sheet, with a SELECT function. If it was just that, i'd hit save and everything would would work perfectly.

However, I have a LOOP running on the main sheet that creates invoices for the sale based on how many parcels the sale has. The loop has 3 main actions, being 1 to create another row on another table using values from the main table, another called LOOP to call that action and add a counter, and another called REPEAT to call the LOOP action and run a list([_thisrow]) command. 

The specific issue is that when I hit save, the main sheet - SALE - saves the new row and runs the LOOP actions before saving the SALE_DETAILS. Because of that, the TOTAL of the sale does not come through, because it's calculated based on the SELECT function that finds items in the SALE_DETAILS table.

The result is that the parcels are all created, but without a price. 

Is there any work around this issue? I've done these LOOPS before and triple checked everything. It's working, but the save order of the appsheet itself is preventing it from doing the calculation correctly.

Oh, I forgot to say, but the LOOP is triggered by a BOT when any change is made to the main table. The bot calls the REPEAT action of the loop that calls the LOOP action, and so on. 

Thanks in advance!

Solved Solved
0 4 217
1 ACCEPTED SOLUTION

Hey man,

I think you're going the wrong route.
I'd go with - the SALE_DETAILS On Add / On Edit / On Delete has to trigger the recalc of the SALE Sheet row - if I were you.

๐Ÿ˜

View solution in original post

4 REPLIES 4

anyone? :((((((((

Hey man,

I think you're going the wrong route.
I'd go with - the SALE_DETAILS On Add / On Edit / On Delete has to trigger the recalc of the SALE Sheet row - if I were you.

๐Ÿ˜

Thanks for your reply, mate.

I actually ran into the same problem in a different app, and thought to try exacly what you suggested hahaha... Well, simply put, I do think it's way simpler! It's just a shame that this should be the case, because ideally i think it's best to keep the actions in the main table, where the data is more optimally distributed, for lack of a better term atm.

Anyway, thanks a lot! I'm still working on it, but pretty sure it should work!

Wonder if there's any other workaround to make it work in the main table though ๐Ÿ˜„

cheers

Thanks man, I know exactly what you mean but I'm guessing it's due to the nature of "no code" applications what we're dealing with here ๐Ÿ˜†

Top Labels in this Space