I'm using "updatecdt" to update a value in the CDT as follows,

Certified Lead Developer
I'm using "updatecdt" to update a value in the CDT as follows,

updatecdt(ac!test,{rndTest2:{rndTest1:{id:333}}})

In this, I need to construct dictionary for second parameter dynamically. I have only field names like {"rndTest2","rndTest1","id"} and value is 333. So I managed it to construct with text type. I tried to pass as a text type then it is throwing an error like "Invalid dictionary". So How can we cast text to dictionary type or any other possible way to pass 2nd parameter. Please suggest me.

Thanks.

OriginalPostID-169098

OriginalPostID-169098

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    over 7 years ago
    Hi mschmitt,

    Thank you for your response.

    The first parameter "ac!test" is a CDT type("rndTest3", Please find attached CDT structure) and it was initialized with data. My concern about second parameter.
    We need to pass only dictionary type so I need to construct dictionary like "{rndTest2:{rndTest1:{id:333}}}" with field names and values. So my question is that how to construct dictionary like {rndTest2:{rndTest1:{id:333}}} dynamically. I have only field names like {"rndTest2","rndTest1","id"} and value is 333. By using these field names and values I need to construct like {rndTest2:{rndTest1:{id:333}}}, which should be a dictionary type.

    Somehow I managed to construct "{rndTest2:{rndTest1:{id:333}}}" in text type but I need it in the dictionary type only because "updatecdt" will accept only dictionary type as second parameter. I am able to construct like "updatecdt(ac!test,"{rndTest2:{rndTest1:{id:333}}}")" but it's throwing error that "Invalid dictionary". So we should pass only dictionary type as second parameter.

    Please suggest me, how to construct dictionary type(second parameter as below) by using field names like {"rndTest2","rndTest1","id"} and value is 333?

    updatecdt(ac!test,{rndTest2:{rndTest1:{id:333}}}).

    Thanks.

Reply
  • 0
    Certified Lead Developer
    over 7 years ago
    Hi mschmitt,

    Thank you for your response.

    The first parameter "ac!test" is a CDT type("rndTest3", Please find attached CDT structure) and it was initialized with data. My concern about second parameter.
    We need to pass only dictionary type so I need to construct dictionary like "{rndTest2:{rndTest1:{id:333}}}" with field names and values. So my question is that how to construct dictionary like {rndTest2:{rndTest1:{id:333}}} dynamically. I have only field names like {"rndTest2","rndTest1","id"} and value is 333. By using these field names and values I need to construct like {rndTest2:{rndTest1:{id:333}}}, which should be a dictionary type.

    Somehow I managed to construct "{rndTest2:{rndTest1:{id:333}}}" in text type but I need it in the dictionary type only because "updatecdt" will accept only dictionary type as second parameter. I am able to construct like "updatecdt(ac!test,"{rndTest2:{rndTest1:{id:333}}}")" but it's throwing error that "Invalid dictionary". So we should pass only dictionary type as second parameter.

    Please suggest me, how to construct dictionary type(second parameter as below) by using field names like {"rndTest2","rndTest1","id"} and value is 333?

    updatecdt(ac!test,{rndTest2:{rndTest1:{id:333}}}).

    Thanks.

Children
No Data