# Change existing "Filter.Rules" of an "ParameterFilterElement"

**URL:** <https://forum.dynamobim.com/t/change-existing-filter-rules-of-an-parameterfilterelement/19526>\
**Category:** Revit\
**Created:** [February 28, 2018, 9:34pm UTC](https://forum.dynamobim.com/t/change-existing-filter-rules-of-an-parameterfilterelement/19526 "2018-02-28T21:34:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew85](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@matthew85](https://forum.dynamobim.com/u/matthew85)\
**Post date:** [February 28, 2018, 9:34pm UTC](https://forum.dynamobim.com/t/change-existing-filter-rules-of-an-parameterfilterelement/19526/1 "2018-02-28T21:34:39Z")

</div>

Hello to everybody,

i am actually working on an tool which creates “ParameterFilterElements”. The aim behind of it -\> handling all filters in an Excel and than let dynamo create the “ParameterFilterElements”. This is already running and doing well. The information in this workflow comes from excel.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/7/5742ad9568fac28f3c585f5ab0c42171c9b633f7.jpg)

**So where is the Problem:**  
If i have to use the tool again to do some changes to some “filter.rules” it can’t be written to revit, because the “ParameterFilterElement.byRules” can’t change or overwrite an existing “ParameterFilterElement”.

**What i have tried:**  
It is no problem to divide the existing “ParameterFilterElements” from the new ones and just create those who are new. So the new ones can be created but those who are already in revit can’t be changed.

**Workaround – delete & new:**  
A Workaround which would work is, to delete the existing “ParameterFilteElements” and create the new one.  
In this case, all definitions in the the “view templates” also will be deleted – so this workaround is not that straight forward…

**Is there any way to change the existing “filter.rules” in the “ParameterFilteElement”??**

thanks for advice.

BR Matthew85

---

<div class="post-metadata">

**Author:** ![e.assinck](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@e.assinck](https://forum.dynamobim.com/u/e.assinck)\
**Post date:** [April 6, 2018, 8:43am UTC](https://forum.dynamobim.com/t/change-existing-filter-rules-of-an-parameterfilterelement/19526/2 "2018-04-06T08:43:16Z")

</div>

Having the same problem.  
Anyone?

---

<div class="post-metadata">

**Author:** ![gertjan.vdb](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gertjan.vdb](https://forum.dynamobim.com/u/gertjan.vdb)\
**Post date:** [April 6, 2018, 9:13am UTC](https://forum.dynamobim.com/t/change-existing-filter-rules-of-an-parameterfilterelement/19526/3 "2018-04-06T09:13:47Z")

</div>

This is not the best idea I confess but …

- Could you gather up all views & templates using this filter,
- Get their overrides.
- Do your Delete & New
- Apply this new filter to the views you’ve gathered

Tedious I know, but it could work.

---

<div class="post-metadata">

**Author:** ![matthew85](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@matthew85](https://forum.dynamobim.com/u/matthew85)\
**Post date:** [April 6, 2018, 12:23pm UTC](https://forum.dynamobim.com/t/change-existing-filter-rules-of-an-parameterfilterelement/19526/4 "2018-04-06T12:23:52Z")

</div>

hello 2 everybody – i just took the workaround… cause there was no solution…

---

<div class="post-metadata">

**Author:** ![Ben\_Osborne](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ben_osborne/32/17366_2.png) [@Ben\_Osborne](https://forum.dynamobim.com/u/Ben_Osborne)\
**Post date:** [April 6, 2018, 1:02pm UTC](https://forum.dynamobim.com/t/change-existing-filter-rules-of-an-parameterfilterelement/19526/5 "2018-04-06T13:02:55Z")

</div>

If you are handy with the Revit API - it appears that there is a method for ParameterFilterElements called ClearRules() which would seem to leave the ParameterFilterElement intact but be waiting for a new revised set of rules from your script.

---

<div class="post-metadata">

**Author:** ![paliitali](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@paliitali](https://forum.dynamobim.com/u/paliitali)\
**Post date:** [September 29, 2020, 6:25am UTC](https://forum.dynamobim.com/t/change-existing-filter-rules-of-an-parameterfilterelement/19526/6 "2020-09-29T06:25:14Z")

</div>

Hi @Ben_Osborne,

After clearing the rules for an existing parameter filter element, is there a node that will set new rules without creating a new filter? If not, do you have an example of how to set new filter rules through Revit API? Thanks

---

<div class="post-metadata">

**Author:** ![Ben\_Osborne](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ben_osborne/32/17366_2.png) [@Ben\_Osborne](https://forum.dynamobim.com/u/Ben_Osborne)\
**Post date:** [September 29, 2020, 10:53am UTC](https://forum.dynamobim.com/t/change-existing-filter-rules-of-an-parameterfilterelement/19526/7 "2020-09-29T10:53:19Z")

</div>

Via the API - you have to first use the Create() method to create the ParameterFilterElement. This is the same as going through the UI and going to filters and creating a new filter and giving it a name. No rules are set yet - it’s just an empty ParameterFilterElement at that point. So in the API - if you use ClearRules() then you have just emptied the rules out of the ParameterFilterElement. You then set the new set of rules the same as when you first created the ParameterFilterElement (see post below)

> [@How to set a series Filter Rules using "OR (Any rule may be ture)" instead of "AND (All rules must be true)"?](https://forum.dynamobim.com/t/how-to-set-a-series-filter-rules-using-or-any-rule-may-be-ture-instead-of-and-all-rules-must-be-true/31656/6):
>
> I’ve done this using Python in Dynamo. To create a Revit Filter (Parameter Filter Element) you need an ICollection of the categories the filter will apply to and an ElementParameterFilter. The Construction of the Element Parameter Filter is the most confusing part because you can construct ElementParameterFilters our of other previously constructed ElementParameterFilters. To try to show this I’ll make a filter that works on Framing and Columns and test for either Comments Equals “Magnum” OR …

---

<div class="post-metadata">

**Author:** ![willem.creffierKCWFB](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/willem.creffierkcwfb/32/180663_2.png) [@willem.creffierKCWFB](https://forum.dynamobim.com/u/willem.creffierKCWFB)\
**Post date:** [August 31, 2023, 11:38am UTC](https://forum.dynamobim.com/t/change-existing-filter-rules-of-an-parameterfilterelement/19526/8 "2023-08-31T11:38:10Z")

</div>

Hi @Ben_Osborne

is there a way to do this within Dynamo?

Kind regards,

Willem
