Simple array variable -> array of objects

I have a “newLabels” array variable that I use to store the uuids of selected items from a multi-select element.

Since this reflects a many-to-many relationship in my database (Supabase), I’m now trying to use this array as part of a batch insert on a junction table i.e. I want to insert as many records as there are items in the array, each with key1 : (same value for all records) and key2: (array item value).

I know the binding syntax for this to work needs to be an array of objects but I can’t figure out how to turn my simple array variable into an array of objects where key 1 has the same value for all items and key 2 has the value of the corresponding item in the array variable.

The AI formula helper is not helpful, only producing formulas that don’t work.

I think this is basically the same question as in this thread Create multiple objects from multi-select except I would like a no-code solution. The last reply in that thread indicates that should be possible but doesn’t elaborate on how.

Any help would be appreciated, thanks!

Hi @gduteaud :wave:

The only idea that comes to mind right now is to use a for loop action in a workflow through the array and create a new one with the proper formatting.

Does that help?

Thank you Joyce! That makes sense but it turns out what I wanted to do is trivial to implement in JS so that’s what I did.

2 Likes

Nice! Would you mind sharing the solution for others who may read this in the future?