Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

Is it possible to fetch a CDT field by numerical index?

Hi all,

I want to get fields in a CDT based on their numerical index, i.e. if I have a CDT like:

{'type!{urn:com:appian:types:TEST}TEST_Employee'('firstName': "Frank", 'secondName': "Smith", 'age': 29)}

To get the first field, is there a way to index it by number? Something like index(local!testCdt, 1, null) would return "Frank". 

Thanks for your help!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Is there a specific reason to do that? While the order is typically fix, I would definitely not rely on it.

  • We have a list of attribute sections that a user can click through, and I need to keep track of which sections have been opened for editing. I've created a CDT that contains the list of attribute sections as the keys and booleans as the values, but I can't make the field names match the attribute section names exactly (one of them has a special character) and I can't make the field names the attribute index because Appian doesn't allow numerical values as field names. 

    What I was planning to do was to get the attribute section index, and use that to index the CDT to fetch the corresponding value.

    So for example:

    Attribute sections indexes and names that a user sees: 

    1. Name

    2. Age & Address

    3. Occupation

    CDT structure:

    'type!{urn:com:appian:types:TEST}TEST_isSectionOpenForEditing'(
    name: 1,
    ageAndAddress: 0,

    occupation: 1
    )

    If the user clicks the second attribute section, Age & Address, I want to fetch the corresponding value from the CDT to verify whether that section is open for editing. 

    Let me know if that makes sense. 

Reply
  • We have a list of attribute sections that a user can click through, and I need to keep track of which sections have been opened for editing. I've created a CDT that contains the list of attribute sections as the keys and booleans as the values, but I can't make the field names match the attribute section names exactly (one of them has a special character) and I can't make the field names the attribute index because Appian doesn't allow numerical values as field names. 

    What I was planning to do was to get the attribute section index, and use that to index the CDT to fetch the corresponding value.

    So for example:

    Attribute sections indexes and names that a user sees: 

    1. Name

    2. Age & Address

    3. Occupation

    CDT structure:

    'type!{urn:com:appian:types:TEST}TEST_isSectionOpenForEditing'(
    name: 1,
    ageAndAddress: 0,

    occupation: 1
    )

    If the user clicks the second attribute section, Age & Address, I want to fetch the corresponding value from the CDT to verify whether that section is open for editing. 

    Let me know if that makes sense. 

Children