Updatecdt function in expression rules

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

Parents
  • 0
    Certified Lead Developer

    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"

  • Hi @mike I have used the same but still it's throwing me error:
    Nested cdts and lists currently not supported.
    Please help me
Reply Children