Multiple Dropdown Duplicate Values

a!sideBySideItem(
item: a!multipleDropdownField(
label: "Status",
labelPosition: "ABOVE",
choiceLabels: {
"Active",
"Approved",
"Cancelled"
},
choiceValues: {
true,
true,
true
},
saveInto: {local!activeSOWs, local!approvedSOWs, local!cancelledSOWs},
validations: {}
)
)

All three of the variables I would like to saveInto are booleans but I am getting an error:

Interface Definition: Expression evaluation error at function a!multipleDropdownField [line 700]: A multiple dropdown component [label="Status"] has an invalid value for "choiceValues". Duplicate items are not allowed in the choiceValues array, but choiceValues was true; true; true.

How can I set the three variables to true when the labels are selected? Thanks!

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    This isn't how the saveInto of a multiple dropdown field works. The output is supposed to be a single variable representing an array of the items chosen in the dropdown.

    If it weren't for the error you're getting, you would still not be getting the output you're expecting in your three local variables. What you would get instead is the same value being saved to all 3 local variables. As soon as you choose one of the dropdown values, all 3 local variables would have their values set as an array of one item relating to the one choice chosen. When a second one is chosen, all 3 would have their values set as an array of 2 items, etc.

    Can you tell us a little bit more about your use case, and what values you were expecting the three local variables to have after the dropdown field is interacted with? That way we can perhaps suggest a solution, which I'm guessing will involve some standard saveInto gymnastics.
  • Hi Morgane,

    Can you please try this code.

    a!sideBySideItem(
    item: a!multipleDropdownField(
    label: "Status",
    labelPosition: "ABOVE",
    choiceLabels: {
    "Active",
    "Approved",
    "Cancelled"
    },
    choiceValues: {
    "Active",
    "Approved",
    "Cancelled"
    },
    value:local!locval,
    saveInto: {
    local!locval,
    if(contains(local!locval, "Active"),a!save(local!activeSOWs,true),{}),
    if(contains(local!locval, "Approved"),a!save(local!approvedSOWs,true),{}),
    if(contains(local!locval, "Cancelled"),a!save(local!cancelledSOWs,true),{}),

    },
    validations: {}
    )
    )

    Hope it is help to u.
    Regards,
    Bhanu
  • ChoiceValues and ChoiceLabels have to be unique. If you want to apply the same value for each choice, I think it is best to use a radio button. This way, you don't have to worry about duplicate values.
  • 0
    Certified Lead Developer
    Hi Morgane,

    Firstly Choice Values cannot contain nulls or duplicate values. The same is mentioned in Notes of Multiple Dropdown Component (FYR: docs.appian.com/.../Multiple_Dropdown_Component.html).

    If you still want to save true for the mentioned choice labels you can go with the solution mentioned by bhanuprakashm806. I would recommend to keep the choice values different as it helps you differentiate the selection you made.