Dropdown component choice share choice list

I have two or more dropdown component and I hope that these dropdown components can share one choice list.

For example

I have a list like {choice 1, choice 2, choice 3, choice 4,...}

In dropdown 1 the choice list should be  {choice 1, choice 2, choice 3, choice 4,...}, when I choose choice 1 in this dropdown, the choice list of other dropdown should be  {choice 2, choice 3, choice 4,...},  when I choose choice 2 in dropdown 2, the choice list of other dropdown (expect dropdown 1 and dropdown 2) should be {choice 3, choice 4,...}

Can appian do like this?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hello  ,

    Yes, can be done in Appian. Could you please elaborate where you would be saving the selected values? Is this going to be a huge set of dropdowns or just a couple of dropdowns with this behavior. 

  • 0
    Certified Senior Developer
    in reply to edwardc8281

    a!localVariables(
      local!labels1: {
        "Option 1",
        "Option 2",
        "Option 3",
        "Option 4",
        "Option 5",
        "Option 6",
        "Option 7",
        "Option 8",
        "Option 9",
        "Option 10",
        "Option 11",
        "Option 12"
      },
      local!value1,
      local!labels2: remove(
        local!labels1,
        wherecontains(local!value1, local!labels1)
      ),
      local!value2,
      local!labels3: remove(
        local!labels2,
        wherecontains(local!value2, local!labels2)
      ),
      local!value3,
      {
        a!dropdownField(
          choiceLabels: local!labels1,
          choiceValues: local!labels1,
          label: "Dropdown",
          labelPosition: "ABOVE",
          placeholder: "--- Select a Value ---",
          value: local!value1,
          saveInto: { local!value1 },
          searchDisplay: "AUTO",
          validations: {}
        ),
        a!dropdownField(
          choiceLabels: local!labels2,
          choiceValues: local!labels2,
          label: "Dropdown",
          labelPosition: "ABOVE",
          placeholder: "--- Select a Value ---",
          value: local!value2,
          saveInto: { local!value2 },
          disabled: a!isNullOrEmpty(local!value1),
          searchDisplay: "AUTO",
          validations: {}
        ),
        a!dropdownField(
          choiceLabels: local!labels3,
          choiceValues: local!labels3,
          label: "Dropdown",
          labelPosition: "ABOVE",
          placeholder: "--- Select a Value ---",
          value: local!value3,
          saveInto: { local!value3 },
          disabled: a!isNullOrEmpty(local!value2),
          searchDisplay: "AUTO",
          validations: {}
        )
      }
    )

    You might want to redo the code a little bit. This is an example of how you can handle.

  • Thanks Konduru, I have tried this way, but if I have a huge dropdowns, like I have 10 dropdown component, I should creat 10 labels and values, right? What I want is use a more common or easy way to imply my require.

  • I have also tried this way, but I failed.

    a!localVariables(
      local!choiceLabels: {
        "Option 1",
        "Option 2",
        "Option 3",
        "Option 4",
        "Option 5",
        "Option 6",
        "Option 7",
        "Option 8",
        "Option 9",
        "Option 10",
        "Option 11",
        "Option 12"
      },
      local!choiceValues: { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 },
      local!checkedValue: a!refreshVariable(
        value: { ri!q1Choice, ri!q2Choice },
        refreshAlways: true
      ),
      local!uncheckedValue: a!refreshVariable(
        value: symmetricdifference(local!choiceValues, local!checkedValue),
        refreshAlways: true
      ),
      {
        a!dropdownField(
          choiceLabels: local!uncheckedValue,
          choiceValues: local!uncheckedValue,
          label: "Dropdown",
          labelPosition: "ABOVE",
          placeholder: "--- Select a Value ---",
          value: ri!q1Choice,
          saveInto: ri!q1Choice,
          searchDisplay: "AUTO",
          validations: {}
        ),
        a!dropdownField(
          choiceLabels: local!uncheckedValue,
          choiceValues: local!uncheckedValue,
          label: "Dropdown",
          labelPosition: "ABOVE",
          placeholder: "--- Select a Value ---",
          value: ri!q2Choice,
          saveInto: ri!q2Choice,
          searchDisplay: "AUTO",
          validations: {}
        )
      }
    )

  • 0
    Certified Senior Developer
    in reply to edwardc8281

    Create an expression rule to perform the logic and reuse based on the input value.

Reply Children
No Data