Drop downs using queries for the Labels/Values

I am fairly new to Appian and need to create a form with a multi drop down where the labels come from the results of a query

How do I define the Labels and Values correctly.

I have a CDT called Developer that has two columns, developerId and developerName

I want the choiceLabels to be the developerName values and the choiceValues to be the developerId.

Both are text fields. I have set up the drop down with static and Constants but I am not sure how to do this with the results of queries.

Please help.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You should do the query into a load() variable.  Then when you want to populate the dropdown labels and values, you can refer directly to the pre-queried properties stored in that variable.

    Something like:

    load(
    local!myValues: rule!queryDevelopers(active: true()),

    a!formLayout(
    contents: {
    a!dropdownField(
    label: "Select Developer",
    choiceLabels: local!myValues.developerName,
    choiceValues: local!myValues.developerId,
    value: ri!selectedDeveloperId,
    saveInto: ri!selectedDeveloperId,
    placeholderLabel: "--Select a Developer--"
    )
    }
    )
    )
Reply
  • 0
    Certified Lead Developer

    You should do the query into a load() variable.  Then when you want to populate the dropdown labels and values, you can refer directly to the pre-queried properties stored in that variable.

    Something like:

    load(
    local!myValues: rule!queryDevelopers(active: true()),

    a!formLayout(
    contents: {
    a!dropdownField(
    label: "Select Developer",
    choiceLabels: local!myValues.developerName,
    choiceValues: local!myValues.developerId,
    value: ri!selectedDeveloperId,
    saveInto: ri!selectedDeveloperId,
    placeholderLabel: "--Select a Developer--"
    )
    }
    )
    )
Children