Saving Multiple Dropdown Labels and Choices.

Hi,

I'm new to Appian and apologies if I missed something really obvious.
I'm running into an issue attempting to capture selected choices and their respective labels of an a!multipleDropdownField().

I've declared 4 local variables to hold the list of available choice labels, available choices, selected choice labels and selected choices.

a!localVariables(
  local!arrChoiceLabels: {"Option1", "Option2", "Option3"},
  local!arrChoiceValues: {1, 2, 3},
  local!arrSelectedLabel: if(
    a!isNullOrEmpty(ri!rec.selected),
    {},
    split(ri!rec.selected,";")
  ),
  local!arrSelectedif(
    a!isNullOrEmpty(local!arrSelectedLabel),
    {},
    wherecontains(local!arrSelectedLabel,local!arrChoiceLabels)
  ),

Then I tried to plug them into the multiple dropdown field,
  a!multipleDropdownField(
    choiceLabels: local!arrChoiceLabels,
    choiceValues: local!arrChoiceValues,
    label: "Appian Multi Select Dropdown",
    labelPosition: "ABOVE",
    value: {local!arrSelected},
    saveInto: {
      local!arrSelected,
      a!save(
        local!arrSelectedLabel,
        index(local!arrChoiceLabels, local!arrSelected, {})
      ),
      a!save(
        ri!rec.selected,
        tostring(local!arrSelectedLabel)
      )
    },
    searchDisplay: "AUTO",
    validations: {}
  ),

The above implementation results in a list of properly selected/deselected labels in arrSelectedLabel list (which flattens fine into the rules input string) but only the first selected element will show in arrSelected list. The drop down itself will reflect that by only highlighting the first selected choice as well. I've also tried replacing the index function with a!forEach - local!arrChoiceLabels[fv!item] loop with the same results.
Any ideas where I went wrong?

Thank you!

  Discussion posts and replies are publicly visible

Parents
  • a!localVariables(
      local!arrChoiceLabels: {"Option1", "Option2", "Option3"},
      local!arrChoiceValues: {1, 2, 3},
      local!arrSelectedLabel: if(
        a!isNullOrEmpty(ri!rec.selected),
        {},
        split(ri!rec.selected,";")
      ),
      local!arrSelected: if(
        a!isNullOrEmpty(local!arrSelectedLabel),
        {},
        wherecontains(local!arrSelectedLabel,local!arrChoiceLabels)
      ),
      {
        a!multipleDropdownField(
          choiceLabels: local!arrChoiceLabels,
          choiceValues: local!arrChoiceValues,
          label: "Appian Multi Select Dropdown",
          labelPosition: "ABOVE",
          value: {local!arrSelected},
          saveInto: {
            local!arrSelected,
            a!save(
              local!arrSelectedLabel,
              index(local!arrChoiceLabels, save!value, {})
            )
          },
          searchDisplay: "AUTO",
          validations: {}
        )
      }
    )

Reply
  • a!localVariables(
      local!arrChoiceLabels: {"Option1", "Option2", "Option3"},
      local!arrChoiceValues: {1, 2, 3},
      local!arrSelectedLabel: if(
        a!isNullOrEmpty(ri!rec.selected),
        {},
        split(ri!rec.selected,";")
      ),
      local!arrSelected: if(
        a!isNullOrEmpty(local!arrSelectedLabel),
        {},
        wherecontains(local!arrSelectedLabel,local!arrChoiceLabels)
      ),
      {
        a!multipleDropdownField(
          choiceLabels: local!arrChoiceLabels,
          choiceValues: local!arrChoiceValues,
          label: "Appian Multi Select Dropdown",
          labelPosition: "ABOVE",
          value: {local!arrSelected},
          saveInto: {
            local!arrSelected,
            a!save(
              local!arrSelectedLabel,
              index(local!arrChoiceLabels, save!value, {})
            )
          },
          searchDisplay: "AUTO",
          validations: {}
        )
      }
    )

Children