# Programmatically Add a Toolbar Filter Chip?

**URL:** <https://forum.servoy.com/t/programmatically-add-a-toolbar-filter-chip/20751>\
**Category:** Questions\
**Created:** [April 30, 2022, 1:14am UTC](https://forum.servoy.com/t/programmatically-add-a-toolbar-filter-chip/20751 "2022-04-30T01:14:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![john1598360627](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@john1598360627](https://forum.servoy.com/u/john1598360627)\
**Post date:** [April 30, 2022, 1:14am UTC](https://forum.servoy.com/t/programmatically-add-a-toolbar-filter-chip/20751/1 "2022-04-30T01:14:36Z")

</div>

I want to create a Dropdown button that acts like a kind of a Quick Filter button. When you click on an item, it would add a chip automatically with a value to the filter set. This in contrast to a user manually adding their own filter chip via a list of available columns.

[attachment=1]quick-filter.png[/attachment]

[attachment=0]Screenshot 2022-04-29 180647.png[/attachment]

Is there a way of programmatically adding a filter chip?

![Screenshot 2022-04-29 180647.png](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/c/c14e62dd9421e2db34619bd57972b3e3af447cdc.png)

 ![quick-filter.png](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/0/03b617dc9b1f44d3809313c66bc3d4151e0983a9.png)

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [May 2, 2022, 4:13pm UTC](https://forum.servoy.com/t/programmatically-add-a-toolbar-filter-chip/20751/2 "2022-05-02T16:13:22Z")

</div>

Hi John,

you can programatically set a filter doing this (for example)

```auto
toolbarFilter.setFilterValue(fv_toolbarFilter.getFilter('status'), ['OPEN'], scopes.svyPopupFilter.OPERATOR.EQUALS)

```

where ‘toolbarFilter’ is the form variable on to which the filterobject is bound  
I assumed ‘status’ would be the column name you want to filter on.

This should also be an existing filter option for the users, otherwise it won’t work.

Hope this helps

---

<div class="post-metadata">

**Author:** ![john1598360627](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@john1598360627](https://forum.servoy.com/u/john1598360627)\
**Post date:** [May 14, 2022, 1:02am UTC](https://forum.servoy.com/t/programmatically-add-a-toolbar-filter-chip/20751/3 "2022-05-14T01:02:05Z")

</div>

> mboegem:  
> Hi John,
> 
> you can programatically set a filter doing this (for example)
> 
> ```auto
> toolbarFilter.setFilterValue(fv_toolbarFilter.getFilter('status'), ['OPEN'], scopes.svyPopupFilter.OPERATOR.EQUALS)
> 
> ```
> 
> where ‘toolbarFilter’ is the form variable on to which the filterobject is bound  
> I assumed ‘status’ would be the column name you want to filter on.
> 
> This should also be an existing filter option for the users, otherwise it won’t work.
> 
> Hope this helps

Alrighty, I haven’t tried this out yet since I’m working on other stuff. But when I get the chance I’ll try this out.
