# Build an Array to filter a collection list from buttons

**URL:** <https://community.weweb.io/t/build-an-array-to-filter-a-collection-list-from-buttons/8891>\
**Category:** Ask us anything\
**Tags:** workflows, binding, filter\
**Created:** [May 31, 2024, 3:04am UTC](https://community.weweb.io/t/build-an-array-to-filter-a-collection-list-from-buttons/8891 "2024-05-31T03:04:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![itsmatttidwell](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@itsmatttidwell](https://community.weweb.io/u/itsmatttidwell)\
**Post date:** [May 31, 2024, 3:04am UTC](https://community.weweb.io/t/build-an-array-to-filter-a-collection-list-from-buttons/8891/1 "2024-05-31T03:04:40Z")

</div>

Hi! I’m working on an alternate filtering solution for the multi-select dropdown and am thinking/trying to use buttons to add different id’s to my filter.

[  
Care Transformation Studio | WeWeb - 30 May 2024 - Watch Video  
 ](https://www.loom.com/share/c25c9dab1a044cea8fbb4cf0271a9bcc)[![](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/5/562f2ecff3ee85f677ad5eff2b8ec9e3b4c594a4.gif)](https://www.loom.com/share/c25c9dab1a044cea8fbb4cf0271a9bcc)  
I’m stuck on creating the actual array (and most likely then applying it to the collection displayed in the video.)

Any help would be so great - I’m just stuck here.

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [May 31, 2024, 7:23am UTC](https://community.weweb.io/t/build-an-array-to-filter-a-collection-list-from-buttons/8891/2 "2024-05-31T07:23:57Z")

</div>

You can create the array as a variable and then on each button you could add a workflow that appends/removes an item via the change variable action.

---

<div class="post-metadata">

**Author:** ![itsmatttidwell](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@itsmatttidwell](https://community.weweb.io/u/itsmatttidwell)\
**Post date:** [May 31, 2024, 5:01pm UTC](https://community.weweb.io/t/build-an-array-to-filter-a-collection-list-from-buttons/8891/3 "2024-05-31T17:01:14Z")

</div>

Thanks! I’m working on that now - just trying to figure out the formatting for the array. I’ll keep going and share if I can’t get it figured out. Appreciate the note 🙂

---

<div class="post-metadata">

**Author:** ![GregoryRosa](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@GregoryRosa](https://community.weweb.io/u/GregoryRosa)\
**Post date:** [June 9, 2024, 5:30pm UTC](https://community.weweb.io/t/build-an-array-to-filter-a-collection-list-from-buttons/8891/4 "2024-06-09T17:30:35Z")

</div>

Hi @Broberto I have the same problem, I managed to add the selected item to the array but I don’t know how to remove it from the array when I click on it again.

Do you have any tips?

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [June 9, 2024, 5:51pm UTC](https://community.weweb.io/t/build-an-array-to-filter-a-collection-list-from-buttons/8891/5 "2024-06-09T17:51:01Z")

</div>

You could do something like a `Change variable` → `Remove at index` → set the index to `[your_array_reference].indexOf(your_current_item_present_in_the_array_reference)`

---

<div class="post-metadata">

**Author:** ![GregoryRosa](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@GregoryRosa](https://community.weweb.io/u/GregoryRosa)\
**Post date:** [June 9, 2024, 5:53pm UTC](https://community.weweb.io/t/build-an-array-to-filter-a-collection-list-from-buttons/8891/6 "2024-06-09T17:53:14Z")

</div>

nice thank you
