We are currently performing maintenance on Appian Community. As a result, discussions posts and replies are temporarily unavailable. We appreciate your patience.

If I have a CDT is there any way for me to list out each of its fields by name d

If I have a CDT is there any way for me to list out each of its fields by name dynamically? I was playing around with some of the functions but haven't seen anything yet.

OriginalPostID-166634

OriginalPostID-166634

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer
    I've actually written a rule to do exactly this for debugging and I think it's output is a little easier on the eyes. If you toss the below into an interface rule you can pass it any object or array and it will tell you the number of items, the item type and break out all of the fields and their values in an easy to read format. I find it particularly helpful when debugging issues related to single element arrays vs single objects. Note that it doesn't handle nested CDTs very well.

    a!paragraphField(
    label: "Details: " & rule!lengthNullSafe(ri!object) & " x " & typename(typeof(ri!object)),
    value: joinarray(split(joinarray(split(tostring(ri!object), ","), char(10)), "; "), char(10) & char(10)),
    readOnly: true()
    )
Reply
  • 0
    Certified Associate Developer
    I've actually written a rule to do exactly this for debugging and I think it's output is a little easier on the eyes. If you toss the below into an interface rule you can pass it any object or array and it will tell you the number of items, the item type and break out all of the fields and their values in an easy to read format. I find it particularly helpful when debugging issues related to single element arrays vs single objects. Note that it doesn't handle nested CDTs very well.

    a!paragraphField(
    label: "Details: " & rule!lengthNullSafe(ri!object) & " x " & typename(typeof(ri!object)),
    value: joinarray(split(joinarray(split(tostring(ri!object), ","), char(10)), "; "), char(10) & char(10)),
    readOnly: true()
    )
Children
No Data