Hi All ,
Can u please tell me how to use updatecdt() function in expression rule .
Load(
Local!data:{
{Id: 1, order:null},
{Id:2, order:null},
{Id:3, order:null}
},
local!updateColumn: updatearray(
Local!Data.order,
{1,2,3},
{1,2,3,4}
),
Updatecdt(
Local!Data,
Order:{local! updateColumn}
)
It's throwing me error when using updatecdt function. Please help me out.
Thanks,
Bhargavi
Discussion posts and replies are publicly visible
The second parameter of updateCdt needs to be a set, containing an array of properties and new values (array in itself). So if you're only updating one of the properties of local!Data, it would be an array of 1. Also, your updateColumn is setting one too many new column indices, it needs to only use the array {1,2,3} instead of {1,2,3,4}.
load( Local!data:{ {Id: 1, order:null}, {Id: 2, order:null}, {Id: 3, order:null} }, local!updateColumn: tointeger( updatearray( Local!Data.order, {1,2,3}, {1,2,3} ) ), updatecdt( Local!Data, { order:{(local!updateColumn)} } ) )
Also note: the property name ("order") used in updateCdt needs to match the case as found in the initial dictionary - if you use uppercase as in your example, it will insert a new property with the uppercase "O" instead of replacing what was already in the "order"
Here's the output I get when using the code I posted before:
If you're getting something different, can you post a screenshot?
Also if you don't need the updateArray portion, you can use updateCdt directly if given the correct syntax:
load( Local!data:{ {Id: 1, order:null}, {Id: 2, order:null}, {Id: 3, order:null} }, updatecdt( Local!Data, { order: {1, 2, 3} } ) )
output:
In that case you simply need to generate a new array for the values needed in the "order" property; you can do this beforehand by whatever logic you need, then pass it into updateCdt(). It just needs to match the length of the local!data array.