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. 

  • 0
    Certified Lead Developer
    in reply to johng0005

    Why not store this in a key-value fashion? Then you can store the section technical names in constants and easily refer to them in UI and in the key-value store.

Reply Children