foreach update another counter
Hi there,
I have a list of applications (n) which have to be equally distributed amongst users (n). Say there are 10 applications and 3 users where application is a CDT and I am using updatedictnary () for setting application.user : user1. Distribution should be like -->
application 1 : user 1
application 2 : user 2
application 3 : user 3
application 4 : user 1
application 5 : user 2
application 6 : user 3
application 7 : user 1
application 8 : user 2
application 9 : user 3
application 1 : user 1
How can this be achieved using only foreach? or is there any better way to do it? Something I tried
local!i:1,
local!UserList : {touser("ABC"),touser("PQR"),touser("GHJ")},
local!UserCount : count(local!UserList),
a!forEach(
items: local!LoanApplicationList,
expression :
updatedictionary(
dictionary: fv!item,
fieldsAndValues: {
ApplicationUser :
if(local!i=local!ListTotalUserCount,
{
local!i:sum(local!i,1),
tostring(ri!UserList[local!i])
},
tostring(ri!UserList[local!i])
)
}
)
)
Thanks in advance,
Sweta
