I have the below mentioned throwing the mismatch error. pls guide
a!forEach( items: ri!Addresslist, expression: reduce( a!update, fv!item, merge( { "AddressId", "ReferenceId", "Type", "CreateBy", "CreateDate" }, { if( fv!item.AddressId = ri!primarykey, null, fv!item.AddressId ), ri!Dependent[fv!index].AppianUserId, "Permanent Home Address", loggedInUser(), a!defaultValue(fv!item.CreateDate, now()) } ) ))
Expression evaluation error at function a!forEach: Error in a!forEach() expression during iteration 4: Expression evaluation error at function 'merge' parameter 2 [line 14]: Invalid index (4) for list: valid range is 1..3
Discussion posts and replies are publicly visible
Your use of "reduce()" here does not make sense. What are you hoping to accomplish / why aren't you just using a!update() on its own?
I am trying to update the reference_id in table address & from dependent table from of field appianuserid
And what purpose is reduce() serving in this?
reduce provide the utitlity to perform specific action to be run for all listed items in address table.just try to avoid the nested foreach loop.
om786 said:reduce provide the utitlity to perform specific action to be run for all listed items in address table.
I'm almost completely sure reduce() is not needed here and will actively mess you up. Unless each item in ri!address somehow also contains a list (array) of items. Can you share what the data structure of ri!address is, in general?