comparing values of CDT in array

Hello,

 

I have a local variable storing list of CDT as array.

local!b:{
'type!{urn:com:appian:types:folders}CMN_RootCaseFolder'( objectId: "1", objectName: "A", parentId: "1"),
'type!{urn:com:appian:types:folders}CMN_RootCaseFolder'( objectId: "2", objectName: "B",parentId: "2"),
'type!{urn:com:appian:types:folders}CMN_RootCaseFolder'( objectId: "3", objectName: "C", parentId: "2"),
'type!{urn:com:appian:types:folders}CMN_RootCaseFolder'( objectId: "4", objectName: "D", parentId: "1"),
'type!{urn:com:appian:types:folders}CMN_RootCaseFolder'( objectId: "5", objectName: "E", parentId: "1"
'type!{urn:com:appian:types:folders}CMN_RootCaseFolder'( objectId: "6", objectName: "F", parentId: "2")
},

 

In this array of CDT type, the logic which I am trying to achieve is to check if the array element object id is acting as parent of other array elements present in the same local!b.

For Example: the objectId="1" is present as parentId in 2 elements (objectName=D,E)

Please suggest how to achieve it.

Any response would be appreciated.

Thanks in advance,

Divya

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    Hi for this you need to do looping over this cdt array using a!foreach()

    Where during each iteration you need to use wherecontains() to check whether this current cdt object id is present as parentid to some other cdt or not, if yes, store it's index in a local variable using append.

    This should work.

    But out of interest, let's assume you have got the CDT indexes where id is being referred as parentid, then what? What exactly you are trying to achieve, I mean, you just want to know the CDT indexes or you want to do some manipulation on this?
Reply
  • 0
    Certified Lead Developer
    Hi for this you need to do looping over this cdt array using a!foreach()

    Where during each iteration you need to use wherecontains() to check whether this current cdt object id is present as parentid to some other cdt or not, if yes, store it's index in a local variable using append.

    This should work.

    But out of interest, let's assume you have got the CDT indexes where id is being referred as parentid, then what? What exactly you are trying to achieve, I mean, you just want to know the CDT indexes or you want to do some manipulation on this?
Children
No Data