How to get CDT elements as value

Hi All,

I have a requirement where a DB table columns i.e. my CDT elements should be in dropdown values (as choice labels /values).

For example: I have a DB table Employee and underlying CDT employee_CDT. I need all columns name as output (a string array).

How can I get all the elements of this CDT in an array?


Thanks,

Nidhi

  Discussion posts and replies are publicly visible

Parents
  • +2
    Certified Lead Developer
    Hi Nidhi,

    Try using below logic.

    load(
    local!CDTFields: split(stripwith(tostring('type!{urn:com:appian:types}employee_CDT'()),"[=] "), ","),


    { local!CDTFields}

    )

    this will give you all elements of your CDT "employee_CDT". If you want to remove/hide any column, lets say default "id" column. then use difference function. As below code.

    load(
    local!CDTFields: split(stripwith(tostring('type!{urn:com:appian:types}employee_CDT'()),"[=] "), ","),


    { difference(local!CDTFields,"id") }

    )
Reply
  • +2
    Certified Lead Developer
    Hi Nidhi,

    Try using below logic.

    load(
    local!CDTFields: split(stripwith(tostring('type!{urn:com:appian:types}employee_CDT'()),"[=] "), ","),


    { local!CDTFields}

    )

    this will give you all elements of your CDT "employee_CDT". If you want to remove/hide any column, lets say default "id" column. then use difference function. As below code.

    load(
    local!CDTFields: split(stripwith(tostring('type!{urn:com:appian:types}employee_CDT'()),"[=] "), ","),


    { difference(local!CDTFields,"id") }

    )
Children