Multiselect default value in form


I have some difficulty to display default values of a multiselect component which is contained in a form.
I have a first form that can save data, and i can edit this data with a second form. This second form is populated with a table selectedrow data with the good form data key. All data is ok except the multiselect's one. There's no display of the data & i can't save it back because this data is required.

Data is store in DB so array is converted to string. I try to change the default value with the solution in there, but form data won't change...



Hi @Julien_COLOMBEAU, is the capitalization of the options matching the values?

For example,

If the the options are lowercase:

And the values are capitalized, no values will be selected by default:

However, if the capitalization matches, the values will be selected:

Thanks for your answer but capitalization is not the problem, the list and the variables are the same.

Could you share a screenshot of the options? I wonder if the data source is not populating them correctly.

Here are the options labeled

and the options of multiselect.
I use a text component, so they can view the options, and i test the value with the stored one before saving to avoid the problem.
It does the job for now.

I think I found the issue. It looks like this expression is evaluating to a string: "["ele1", "ele2", "ele3"]"

I updated my options to have labels and values to try and reproduce. As long as the default value is an array of strings that match the values from the options, they get selected:

Which is weird because the tooltip is showing that is an array. Let's try using a Transformer. Define a const data = [], then manually push each filtered element into it, and return the "data" array. Use this transformer as the data source instead.