# Implementing filter in code

**URL:** <https://community.weweb.io/t/implementing-filter-in-code/5721>\
**Category:** How do I?\
**Created:** [December 5, 2023, 1:48am UTC](https://community.weweb.io/t/implementing-filter-in-code/5721 "2023-12-05T01:48:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mitsley](https://avatars.discourse-cdn.com/v4/letter/m/e99b99/32.png) [@mitsley](https://community.weweb.io/u/mitsley)\
**Post date:** [December 5, 2023, 1:48am UTC](https://community.weweb.io/t/implementing-filter-in-code/5721/1 "2023-12-05T01:48:25Z")

</div>

Hi there,

I have a set of filters (including drop downs, date fields, sliders, etc) that I want to apply to multiple elements (charts, a map, a datagrid, etc).

How can I implement the filter in code, so I can easily apply it to the elements I want to fillter. (I.e. how can I avoid manually adding a dozen filters to each element I want to filter?)

Final note: it’s a lot of data and important to the UX that the controls update fast, so I want to filter on the front-end.

Many thanks!

---

<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:** [December 5, 2023, 8:40am UTC](https://community.weweb.io/t/implementing-filter-in-code/5721/2 "2023-12-05T08:40:58Z")

</div>

I’d say create a formula, if the filter is always the same and just use that. I think that’s a similar logic to how the frontend filters work

---

<div class="post-metadata">

**Author:** ![mitsley](https://avatars.discourse-cdn.com/v4/letter/m/e99b99/32.png) [@mitsley](https://community.weweb.io/u/mitsley)\
**Post date:** [December 6, 2023, 5:18am UTC](https://community.weweb.io/t/implementing-filter-in-code/5721/3 "2023-12-06T05:18:44Z")

</div>

Thanks, Broberto.

Will I have to drop into Javascript? I don’t see a formula that allows filtering of an array based on multiple criteria.

I could nest the formulas but there are several criteria and I suspect it would be slow.

---

<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:** [December 6, 2023, 7:25am UTC](https://community.weweb.io/t/implementing-filter-in-code/5721/4 "2023-12-06T07:25:04Z")

</div>

I’m afraid that’s the case. You can use copilot though 🙂
