Dropdown with an array

Hi,

When I am trying to assign an array to a local variable and use the same for dropdown choiceLabels and choiceValues, I am getting an error.

Any idea why I am getting this error. 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi,

    Don't use merge function to append two arrays. Review Appian documentation if you are not sure about that function. I am posting a sample code here, it will work for your case.

    a!localVariables(
      local!reviewOptionLable1AI: {"Additional Info Required"},
      local!reviewOptionValueAI: {"AIR"},
      local!reviewOptionLabelCancel: {"Cancelled"},
      local!reviewOptionValueCancel: {"CSED"},
      local!reviewOptionLable: {local!reviewOptionLable1AI, local!reviewOptionLabelCancel},
      local!reviewOptionValue: {local!reviewOptionValueAI, local!reviewOptionValueCancel},
      a!formLayout(
        contents: {
          a!dropdownField(
            label: "Review Options",
            placeholder: "--- Select a Review Option ---",
            choiceLabels: local!reviewOptionLable,
            choiceValues: local!reviewOptionValue,
            value: "",/*your rule input*/
            saveInto: {
              /*save back to your rule input*/
            }
          )
        }
      )
    )
     

Reply
  • 0
    Certified Lead Developer

    Hi,

    Don't use merge function to append two arrays. Review Appian documentation if you are not sure about that function. I am posting a sample code here, it will work for your case.

    a!localVariables(
      local!reviewOptionLable1AI: {"Additional Info Required"},
      local!reviewOptionValueAI: {"AIR"},
      local!reviewOptionLabelCancel: {"Cancelled"},
      local!reviewOptionValueCancel: {"CSED"},
      local!reviewOptionLable: {local!reviewOptionLable1AI, local!reviewOptionLabelCancel},
      local!reviewOptionValue: {local!reviewOptionValueAI, local!reviewOptionValueCancel},
      a!formLayout(
        contents: {
          a!dropdownField(
            label: "Review Options",
            placeholder: "--- Select a Review Option ---",
            choiceLabels: local!reviewOptionLable,
            choiceValues: local!reviewOptionValue,
            value: "",/*your rule input*/
            saveInto: {
              /*save back to your rule input*/
            }
          )
        }
      )
    )
     

Children