Update value of a local variable to new values inside a foreach loop

Certified Associate Developer

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

Parents Reply Children
No Data