a!localVariables( local!principalAmount:ri!loanAmount, local!totalMonths: ri!tenure * 12, local!interestForOneMonth: round(ri!interest / 12, 2), local!interest: ( local!interestForOneMonth * local!remainingAmount, ) / 100, local!remainingAmount:local!principalAmount-local!interest, a!forEach( items: enumerate(local!totalMonths) + 1, expression: { local!interest, local!principalAmount, local!remainingAmount,
a!save(local!remainingAmount,local!principalAmount-local!interest,), a!save(local!principalAmount, local!remainingAmount), } ), )
For each iteration of the for loop i want to update the value of local!principalAmount and local!remainingAmount as shown above. Kindly let me know how we do this in Appian.
Discussion posts and replies are publicly visible
Nope. They'll change with every iteration. This is a recursion. Create an expression rule with the name as 'LoanCalculator' and paste the above definition. Then save it. Should work!
Awesummmmmm! It worked. Thanks Harshit!!!