As pictures show, i wish to save all list of value to database, but once i add attribute under it, it one keep returning value of the list's first value, why? Is this the defect of appian software it self?
Discussion posts and replies are publicly visible
hello, hope this help
The target parameter accepts a list of variables, in this case you are wrongly passing all the current ids of your rule input variable (2000,2001,200), instead pass them one by onein order to make it work you must perform the save as follows
a!forEach( items: ri!csetenderphases, expression: a!save( fv!item.id, /*just an example, find out the right index for the local list*/ index( local!csetenderphaseslist, fv!index, null ) ))
Alternate way to avoid any loops is to use updateCdt() function. Just use updateCdt to update fields/CDT attributes that do not have direct mappings before saving them into your rule input. For instance based on your screenshot seems like only (.user) attribute is set from another local but other attributes are directly mapped, so in this case code snippet be like -
a!save( ri!csetenderphases, updatecdt( local!csetenderphases, { user: repeat(count(local!csetenderphases), local!newUser) } ) )
could you give a detail version of this? looks like a new idea, i don't know what to write in updatecdt, always failed to try
load( local!data:{ rule!KONE_Development_trail_flatten("song","wang") }, local!updateColumn: tointeger( updatearray( local!data.user, a!forEach( items:rule!KONE_Development_CSE_TENDER_PHASES_Rule(), expression:fv!item.id ), a!forEach( items:rule!KONE_Development_CSE_TENDER_PHASES_Rule(), expression:fv!item.id ), ) ), updatecdt( local!data, { user:{(local!updateColumn)} } ) )
But it is always report,Expression evaluation error at function 'updatearray' [line 7]: The indices are not of the expected type. Type of indices: List of Variant. Type expected: List of Number (Integer)