# Why isn't the result of my formula being recognized by the WeWeb UI?

**URL:** <https://community.weweb.io/t/why-isnt-the-result-of-my-formula-being-recognized-by-the-weweb-ui/8625>\
**Category:** Ask us anything\
**Created:** [May 16, 2024, 3:24pm UTC](https://community.weweb.io/t/why-isnt-the-result-of-my-formula-being-recognized-by-the-weweb-ui/8625 "2024-05-16T15:24:30Z")\
**Posts on this page:** 3\
**Page:** 1

<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, 3:24pm UTC](https://community.weweb.io/t/why-isnt-the-result-of-my-formula-being-recognized-by-the-weweb-ui/8625/1 "2024-05-16T15:24:30Z")

</div>

![CleanShot 2024-05-16 at 11.18.23](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/5/566fc351920ca4c2082c249c5d81cba52409dcd5.gif)

On submitting a form, I perform two actions:

1. Transform a list of selected items from a multi-select input into an array of objects.
2. Use that array of objects for a bulk insert into Supabase.

I wrote this JS code in the formula for Step 1:

```auto
var transformArray = function(array, initiativeId) {
    return array.map(function(value) {
        return {
            initiative_id: parseInt(initiativeId),
            resource_id: value
        };
    });
};

return transformArray(variables['ID-currentSelection'], globalContext.pageParameters['initiative_id']);

```

 ![CleanShot 2024-05-16 at 11.27.03](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/f/fadc31e2a134068c0dad9c8a84799e1298c1c094.png)

I can see that this returns an array of objects.

For Step 2, however, when I try to access the result variable of Action 1, it says the result is undefined.  
 ![CleanShot 2024-05-16 at 11.24.00](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/c/cb10a11c774958f42e8c2ec4d72a378b1e504b73.png)

What am I missing here?

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [May 16, 2024, 3:48pm UTC](https://community.weweb.io/t/why-isnt-the-result-of-my-formula-being-recognized-by-the-weweb-ui/8625/2 "2024-05-16T15:48:36Z")

</div>

you need to test the action to have a value in the preview

---

<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, 3:54pm UTC](https://community.weweb.io/t/why-isnt-the-result-of-my-formula-being-recognized-by-the-weweb-ui/8625/3 "2024-05-16T15:54:25Z")

</div>

Face+Palm moment.

Thanks @dorilama!
