Update many values based on a single value?

Hello,

I build an app and i have an issue.
I have client debts and payments.
I want: when customer makes a payment i want my app to check and if it possible to pay off more than one debts.

Can you give a calculation example?

I’m thinking you’re doing something like this?

Customer debts:

  1. $5
  2. $7
  3. $12

Assuming these debts are already in the priority order of getting payed off.
Say the customer makes a $15 payment, you want the debts to turn into:

  1. 0
  2. 0
  3. $9

?

Yes, exactly that.

I’ve heard of some people using recursive action groups before, but I haven’t yet seen how exactly they’re implemented. I think this sounds like a good application for such a feature. @Steve @Bahbus I believe you two mentioned this some time ago, care to provide some more info?

@Steve has the sample app to demonstrate some recursion. I believe its in his public portfolio.

Can you link this. I’m not sure how to find it.

Which app is using recursion?

https://www.appsheet.com/samples/Demo-Add-any-number-of-rows-from-any-row-within-a-table?appGuidString=60aea168-3ad7-4f9c-ad58-2d3b1f7e7882

1 Like

I believe that the above technique doesnt work.

The recursion aspect of Steve’s example app will help you with your goal. Not the adding of new records. In general terms: instead of decrementing a count as in the example, on each loop apply a Price reduction to the next non-zero Debt record, and decrement the payment value, run until that payment value is 0.

2 Likes

Sometimes it works, but not all the time. I have grouped action,and i realized that the second action executed before the first is completed.