Multiselect default value not behaving as expected

I recently started using Appsmith and love it! First post, so apologies if this is landing in the wrong category and please correct me if so.

I have an app that has multiple tables, each with a single column that is a concatenated, comma-delimited list of ID’s. These ID’s are a subset of values in an associated multiselect widget. When a row is selected from the table, I want the multiselect to dynamically select the values from this column and display their associated labels in the dropdown. A user can then remove them one by one and/or add new selections from the drop down.

A few months ago I successfully did this.

Recently, I started to add new multiselect widgets with the intent of configuring them the same way for other tables, but they are behaving differently. The new multiselect takes all of the values from the column and parses them as a single concatenated value and displays this value in the dropdown as if it were the label.

I have found that if I change syntax slightly, I can get the individual ID’s selected as individual values, but it still displays the values themselves instead of the labels.

If I copy/paste the old widget and repoint it to the right data, I get the desired behavior, but creating a new widget from the widget menu and manually configuring it the same way doesn’t produce the same results. I’ve noticed some other differences such as (Old multiselect has no “Filterable” option but new one does) and (Old multiselect has Label Text positioned to the left, new one has it positioned above the dropdown) This has led me to wonder if the old widget I created was maybe some other type of widget than a multiselect, but from what I can tell it is not (although it is not clear how to definitively determine this).

Here is my config:

Options:

{{ lookup_people_dropdown.data.map((row) => { 
      return { label: row.name, value: row.id } 
   }) 
}}

Default Value:

[{{TABLE_notes_for_cons.selectedRow.people_ids}}]

Here is the evaluated value for the old widget:

[
  22000007,
  22000008
]

and for the new widget:

[
  "22000007, 22000008"
]

Seems like the new widget interprets the column as a string, where as the old one treats it as CSV. Something obvious I am missing?

Hey sorry about the confusion. There was an update in the multiselect field for the way it took default values. Can you try the below code in Default Value and let me know if it helps?

{{lookup_people_dropdown.data.filter(p => TABLE_notes_for_cons.selectedRow.people_ids.includes(p.id)).map(p => ({label: p.name, value: p.id}))}}

That did the trick, thank you @dancia !