Multi-Select Not populating in Form

yes it does. any alternative options I can try instead?

if you keep the column as TEXT you use this script:

{{ item.replace(/[{}"]/g, "").split(",") }}

image



You will need to format the data as {"value1", "value2", etc...}
Don't need to modify anything else

Or if you want to use column as JSON you will need to:
a) in your query use Key value pairs to use {{ multiselect1.value }}
OR
b) Transform the data from form1.data and modify the multiselect1 value to return an Array

@Tess @joeBumbaca Retool Team, is there a better way to handle this situation?

I tried this with the new column after converting it back to a text and it brings us back to the same issue of where the data is being pulled from the previous product that was worked on. (refer to 10/23 of this thread)

Can you provide screenshots for the JSON option? In the modifyForm query, I already have the key value pair set to {{ modifyProductFormsCombined.value }} which gets it's values from this transformer (modifyProductFormsCombined:

let modify_required = {{modifyProductForm.data}}
let modify_optional = {{modifyProductForm2.data}}

return {...modify_required,...modify_optional} //combines everything 
1 Like

can you clarify this? some screenshot of the column in the table component and the multiselect might be more helpful

can you answer the following questions?

  1. Is your table and form in different tabs?
  2. The multiselect component is showing the same data that was before the update?
    e.g.
    before: "value1", "value2"
    changed to: "value3"
    after: "value1", "value2"
  3. is showing the previous data despite other row is selected, or is showing the previous data but the same row still selected?

Created this loom video in hopes of it helping clarify a bit better.

  1. Our table exists in a tabbed container in the product inventory application. The form lives in a modal that is triggered when a user selects the modify button

  2. Multiselect component shows the same for all products despite there being different data. Seems to not refresh when a new product is selected.

  3. the first one. Is showing previous data despite other row is selected.

1 Like

Keeping the column as TEXT

Replacing the data source of the form from {{ yourTableID.selectedSourceRow }} to {{ yourTableID.selectedRow }} may work, since selectedSourceRow contains the data obtained from the query

But if you have other mapped values in your table could broke othe form fields

e.g.

query returns this
client_id = 1
but in your table you want to display the clients name so you set a mapped value to display it (client name)
by using selectedSourceRow you get 1 (actual value) but if you use selectedRow you get client name (mapped value)

If using selectedRow broke anything you can transform the data in your query and apply the JS code in there:

changing from selectedSourceRow to selectedRow seems to have worked!
Thank you so much!

3 Likes