How to update a value of a local variable inside for each loop

Hi,

How can I update the value of a local variable inside the for each loop, for eg I have an array of CDT items and whenever a condition matches inside the for each loop then I need to put that CDT item in a local variable and the value which I have used to check the condition in another variable. Below is the same code snippet, the snippet which is highlighted in red color text is what I need to achieve

a!localVariables(

local!CDTArray: {{AID: 1, GROSS_AMOUNT: 120000, NET_AMOUNT: 90000}, {AID: 2, GROSS_AMOUNT: 115000, NET_AMOUNT: 80000}, {AID: 3, GROSS_AMOUNT: 110000, NET_AMOUNT: 85000}, {AID: 4, GROSS_AMOUNT: 105000, NET_AMOUNT: 75000}}

local!unmatchedTotalAmt: {},

local!unmatchedCDTItem: {},

a!foreach(

items: local!CDTArray,

expression:{

if(fv!item.GROSS_AMOUNT <= 110000,

{

/* put the GROSS_AMOUNT value in local!unmatchedTotalAmt variable */

/* put the current CDT value in local!unmatchedCDTItem variable */

},

null

)

}

)

)

  Discussion posts and replies are publicly visible