# Formula help (array treated a string)

**URL:** <https://community.weweb.io/t/formula-help-array-treated-a-string/1298>\
**Category:** How do I?\
**Created:** [October 15, 2022, 5:27pm UTC](https://community.weweb.io/t/formula-help-array-treated-a-string/1298 "2022-10-15T17:27:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![caffeinatedwes](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/caffeinatedwes/32/625_2.png) [@caffeinatedwes](https://community.weweb.io/u/caffeinatedwes)\
**Post date:** [October 15, 2022, 5:27pm UTC](https://community.weweb.io/t/formula-help-array-treated-a-string/1298/1 "2022-10-15T17:27:36Z")

</div>

Hi WeWeb community, I’m having a difficult time with one particular formula.

Here is the formula—

```auto
values(pick(context.item.data,"dob","last_name"))

```

And here is the corresponding JavaScript—

```auto
return wwFormulas.values(wwFormulas.pick(context.item.data,"dob","last_name"))

```

My goal is to use an array variable in the place of `"dob","city"` so I can add or remove keys via other functions and workflows.

Things I’ve tried

Array variable of `["dob","city"]`  
Text variable of `"last_name","dob"`

Every time I get the error `0: undefined`.

From what I can decipher, it looks like the core problem is that the formula isn’t detecting that the array is actually an array. Instead, it looks like the array is converted to a string. Here, for example, it seems the values as `dob,city` as one key and not separate keys.

![Screen Shot 2022-10-15 at 12.12.57 PM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/2/29366b90db77404e324f3f02e7804197ce0bb6ed.png)

Does anyone have a suggestion for achieving the desired functionality? Is some sort of JavaScript loop needed?

---

<div class="post-metadata">

**Author:** ![caffeinatedwes](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/caffeinatedwes/32/625_2.png) [@caffeinatedwes](https://community.weweb.io/u/caffeinatedwes)\
**Post date:** [October 15, 2022, 7:17pm UTC](https://community.weweb.io/t/formula-help-array-treated-a-string/1298/2 "2022-10-15T19:17:05Z")

</div>

Update: I got it with some custom JS!
