multi drop down selections

Hi team,

My use case requires me to select multiple options like: north, south, east ,west which am able to configure and it's working perfectly.

But there should also be an option to select all(I.e North, south, east, west) and based on it data should be displayed.

Can someone help with the code.

  Discussion posts and replies are publicly visible

Parents
  • Hi,

    I think this piece of code should work for you

    a!localVariables(
      local!choiceLabels: { "All", "East", "West", "North", "South" },
      local!choiceValues: { 0, 1, 2, 3, 4 },
      local!dropDownValue,
      local!value,
      a!multipleDropdownField(
        choiceLabels: local!choiceLabels,
        choiceValues: local!choiceValues,
        value: local!value,
        saveInto: {
          a!save(
            local!value,
            if(
              contains(
                save!value,
                index(local!choiceValues, 1, {})
              ),
              0,
              save!value
            )
          ),
          a!save(
            local!dropDownValue,
            if(
              contains(
                save!value,
                index(local!choiceValues, 1, {})
              ),
              remove(local!choiceValues, 1),
              save!value
            )
          )
        }
      )
    )

    In this, I have added an "All" label in the first index of the array of labels and values, and because of that, I have taken two variables. One for showing the correct value in the dropdown and the second one is to refer to other places where the value is required.

    Thanks

Reply
  • Hi,

    I think this piece of code should work for you

    a!localVariables(
      local!choiceLabels: { "All", "East", "West", "North", "South" },
      local!choiceValues: { 0, 1, 2, 3, 4 },
      local!dropDownValue,
      local!value,
      a!multipleDropdownField(
        choiceLabels: local!choiceLabels,
        choiceValues: local!choiceValues,
        value: local!value,
        saveInto: {
          a!save(
            local!value,
            if(
              contains(
                save!value,
                index(local!choiceValues, 1, {})
              ),
              0,
              save!value
            )
          ),
          a!save(
            local!dropDownValue,
            if(
              contains(
                save!value,
                index(local!choiceValues, 1, {})
              ),
              remove(local!choiceValues, 1),
              save!value
            )
          )
        }
      )
    )

    In this, I have added an "All" label in the first index of the array of labels and values, and because of that, I have taken two variables. One for showing the correct value in the dropdown and the second one is to refer to other places where the value is required.

    Thanks

Children
No Data