Skip to main content
August 24, 2023
Solved

How to configure a dropdown list to save multiple times

  • August 24, 2023
  • 8 replies
  • 0 views

Hi all,

I'm trying to use a single dropdown list to add multiple users to my grid, right now when I Select one it saves it, but if I select the dropdown again it will overwrite my first selection, how can I over come this?

Basically I want to select -> save , select again -> save and so on.

Best answer by mathieud0001

You probably want your saveInto to append to an array.

a!localVariables(
  local!value,
  local!values,
  {
    a!dropdownField(
      label: "Dropdown",
      placeholder: "Choose value",
      choiceLabels: { "Value 1", "Value 2", "Value 3" },
      choiceValues: { "Value 1", "Value 2", "Value 3" },
      value: index(local!value, "name", null),
      saveInto: {
        a!save(local!value, a!map(name: save!value)),
        a!save(
          local!values,
          append(local!values, local!value)
        )
      }
    ),
    a!gridField(
      data: local!values,
      columns: { a!gridColumn(value: fv!row.name) }
    )
  }
)

8 replies

mathieud0001
Brainy
August 24, 2023

You probably want your saveInto to append to an array.

a!localVariables(
  local!value,
  local!values,
  {
    a!dropdownField(
      label: "Dropdown",
      placeholder: "Choose value",
      choiceLabels: { "Value 1", "Value 2", "Value 3" },
      choiceValues: { "Value 1", "Value 2", "Value 3" },
      value: index(local!value, "name", null),
      saveInto: {
        a!save(local!value, a!map(name: save!value)),
        a!save(
          local!values,
          append(local!values, local!value)
        )
      }
    ),
    a!gridField(
      data: local!values,
      columns: { a!gridColumn(value: fv!row.name) }
    )
  }
)

August 24, 2023

Thanks for answering!  ! but since my list of dropwdown is actually a list of data, it gives me this error

Interface Definition: Expression evaluation error at function a!gridField [line 520]: Invalid types, can only act on data of the same type (Text, Any Type)

This is how my choiceValues are : a!forEach(
items: local!iusersData,
expression: fv!item.Soeid
),

for displaying in the grid

mathieud0001
Brainy
August 24, 2023

Not much to go on. Would need more details.