Insert values of a multiselect into separate rows in the database

i have a multi select form and would like to insert the selected values in different rows in a database, any suggestions on how to approach this?

FORM to insert into postcategory
Screenshot from 2022-02-11 14-24-23

Hey @jakinda1,

If I understood correctly, I would create an intermediate JS query to create new postcategory entries.

In your JS query you could iterate over the categories input and trigger a new db query to create a postcategory record.

Does that make sense?

No, not really am also not that good with JS. :grimacing:


Hey there :wave:

Here is a link to an example in our docs of how to trigger a query for each item in an array

Hi there, I am a newby on Retool/JS.... can you supply a bit more info on this script? Where do I insert the referals to the data and the insert script to run?
Thanks in advance

Hey @Ziva_Ika! I'd be happy to help. What are you looking to do here? Would you mind sharing a screenshot or two of your current setup? :slight_smile:

Hi, @victoria, thank you. Actually I found the solution myself yesterday.
I changed the first line from the example code into: var rows = multiselect1.value;
And around line 11 inserted the queryname like so:
additionalScope: {
data: data,

Then in the Insert script configured a Key pair like:

This works for me, if you have any tips I love to hear them.

Awesome, so glad to hear it’s working for you! This looks great to me. Are you interested in tips for any area in particular?