# Create multiple objects from multi-select

**URL:** <https://community.weweb.io/t/create-multiple-objects-from-multi-select/2926>\
**Category:** Ask us anything\
**Tags:** binding, xano\
**Created:** [June 3, 2023, 3:02am UTC](https://community.weweb.io/t/create-multiple-objects-from-multi-select/2926 "2023-06-03T03:02:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesa](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jamesa](https://community.weweb.io/u/jamesa)\
**Post date:** [June 3, 2023, 3:02am UTC](https://community.weweb.io/t/create-multiple-objects-from-multi-select/2926/1 "2023-06-03T03:02:36Z")

</div>

Hi,

I have a post API input that expects an object (or multiple objects) formatted in the following way:

 ![Screenshot 2023-06-02 at 9.31.32 PM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/c/c1bb1c172b0ed00d4f255cf856a42273ca0e6542.png)

I am using the multi-select which is bound to a collection in my Xano project to grab the ID # I need. I am only able to take the first item in my multiselect and create a properly formatted object out of it.

![Screenshot 2023-06-02 at 11.00.34 PM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/f/f380cdfb36a22ce4eef3ec67381c2a6a1ee116a9.png)

 ![Screenshot 2023-06-02 at 10.37.48 PM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b3b53ead7e0438037999efd068d6fdf36f24e816.png)

How do I set this up to where if I have multiple items in my multi-select, I can create multiple objects for binding with my API?

---

<div class="post-metadata">

**Author:** ![raydeck](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raydeck/32/384_2.png) [@raydeck](https://community.weweb.io/u/raydeck)\
**Post date:** [June 3, 2023, 12:29pm UTC](https://community.weweb.io/t/create-multiple-objects-from-multi-select/2926/2 "2023-06-03T12:29:49Z")

</div>

On the front-end, I would use javascript action with a one-liner like:

```auto
[green box with "input multiselect - currentSelection"].map((value)=>({equipmenttypes_id: value}))

```

Adding a bit of JS to crack data manipulation problems is often what we do as part of working on the hardest 5% at [State Change Pro forums and daily office hours](https://statechange.ai).

---

<div class="post-metadata">

**Author:** ![jamesa](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jamesa](https://community.weweb.io/u/jamesa)\
**Post date:** [June 3, 2023, 2:32pm UTC](https://community.weweb.io/t/create-multiple-objects-from-multi-select/2926/3 "2023-06-03T14:32:29Z")

</div>

Thank you for helping and I’ve seen your posts on twitter 🙂

I’m getting undefined when running this arrow function. I have values in my multi-select array as you can see on the right. Any additional help would be appreciated. In the meantime, I will try to run some functions on the backend in Xano and see if that turns out easier.

 ![Screenshot 2023-06-03 at 10.26.56 AM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b16f3c06669c1a9735595a33e057dd1df4aa3096.jpeg)

---

<div class="post-metadata">

**Author:** ![raydeck](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raydeck/32/384_2.png) [@raydeck](https://community.weweb.io/u/raydeck)\
**Post date:** [June 3, 2023, 2:51pm UTC](https://community.weweb.io/t/create-multiple-objects-from-multi-select/2926/4 "2023-06-03T14:51:25Z")

</div>

That return is making a hash of things. By being on a line by itself, it is saying “return the thing after the return word”. And since nothing follows it, it is returning nothing. And Javascript for nothing is “undefined”.

To solve this, put the return keyword in front of your green block so it reads:

```auto
return [green box with "input multiselect - currentSelection"].map((value)=>({equipmenttypes_id: value}))

```

Work any better for you?

---

<div class="post-metadata">

**Author:** ![jamesa](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jamesa](https://community.weweb.io/u/jamesa)\
**Post date:** [June 3, 2023, 3:17pm UTC](https://community.weweb.io/t/create-multiple-objects-from-multi-select/2926/5 "2023-06-03T15:17:44Z")

</div>

It works! 😭

---

<div class="post-metadata">

**Author:** ![Quentin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/quentin/32/6_2.png) [@Quentin](https://community.weweb.io/u/Quentin)\
**Post date:** [June 5, 2023, 3:21pm UTC](https://community.weweb.io/t/create-multiple-objects-from-multi-select/2926/6 "2023-06-05T15:21:39Z")

</div>

You could also do it in no-code using the `map` formula 😉

---

<div class="post-metadata">

**Author:** ![kanepaamauloa](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kanepaamauloa/32/8944_2.png) [@kanepaamauloa](https://community.weweb.io/u/kanepaamauloa)\
**Post date:** [May 16, 2024, 2:18pm UTC](https://community.weweb.io/t/create-multiple-objects-from-multi-select/2926/7 "2024-05-16T14:18:00Z")

</div>

How did you manage to get the fat arrow to work without the formulate editor intervening? When I type ‘=’ or ‘\>’, the formula editor reformats those two characters.

---

<div class="post-metadata">

**Author:** ![raydeck](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raydeck/32/384_2.png) [@raydeck](https://community.weweb.io/u/raydeck)\
**Post date:** [May 16, 2024, 2:32pm UTC](https://community.weweb.io/t/create-multiple-objects-from-multi-select/2926/8 "2024-05-16T14:32:59Z")

</div>

In the upper left of the box you can toggle between formula mode and JavaScript mode. The latter is what you want to implement lambdas and closures.
