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:
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:
?
Yes, exactly that.
@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?
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.
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.
User | Count |
---|---|
40 | |
34 | |
29 | |
23 | |
17 |