Hi Anitha,
The overall approach in above code works as expected just as you explained not sure what is the issue you are facing! I just made a few small tweaks to improve stability.
Here’s the updated version:
a!localVariables(
local!allOptions: {1, 2, 3, 4},
local!selectedOptions: {1, 2, 3, 4},
local!selectAll: true,
{
/* Checkbox Field for Select All / Deselect All */
a!checkboxField(
label: if(local!selectAll, "Deselect All", "Select All"),
choiceLabels: {""},
choiceValues: {true},
value: if(local!selectAll, {true}, {}),
saveInto: {
a!save(
local!selectedOptions,
if(
a!isNullOrEmpty(save!value),
{}, /* Deselect all */
local!allOptions /* Select all */
)
),
a!save(local!selectAll, not(a!isNullOrEmpty(save!value)))
}
),
/* Multiple Dropdown Field */
a!multipleDropdownField(
label: "Options",
choiceLabels: {"A", "B", "C", "D"},
choiceValues: local!allOptions,
value: local!selectedOptions,
saveInto: {
a!save(local!selectedOptions, save!value),
a!save(
local!selectAll,
count(save!value) = count(local!allOptions)
)
}
)
}
)