How exclude one filter from another one?

I am looking for a way to export a single branch (one of my branches) from my tree to GEDCOM. I have created several filters:

Filter 1. Ancestors.
I have 107 search results.

Filter 2. Descendants of Ancestors.
I have 1213 search results.

It works good. But now i need exclude another sub-branch from the resulted branch. The exclude sub-branch has such filter:

Filter 3. Exclude
I have 90 search results.

This is not the best way exclude by surnames because i have a long list there. But I have no idea how do it more clear. I could create excludes similar filters 1 and 2 using “Exclude Ancestors of person ID2” and “Exclude Descendants of Ancestors” but it will also exclude Descendants of person with ID2. Maybe anybody has some propositions.

But the main question is how exclude one filter from another one? I want “Exclude” people from “Descendants of Ancestors” filter.

I tried do it in such way, but looks like it does not work, because I still receive the sane 1213 persons:

Any ideas?
Thanks.

1 Like

What I would like to add is that the filtering mechanism lacks some kind of designer with drag and drop, which can be used to combine existing filters in such a way that some of them include, others exclude search results. Of course, this is easy to say, but difficult to do. But maybe someone has some ideas or plans for the development of filters in this direction.

When wanting to refine some Filter results, I tend to use a temporary Tag and the Add/Remove Tag tool addon.

  1. Make a new tag first.
  2. Add that Tag using the Add/Remove with your 1st Filter
  3. Remove that Tag using the Add/Remove with your 2nd Filter
  4. Reset the Filter Gramplet
  5. filter on the Tag with the Filter Gramplet

If excluding the 2nd filter temporarily, you could Tag the 1st filter’s results, the use the Tag and find results that do not match the 2nd custom filter.

But experimenting with excluding Filters in combination is much more intuitive when using the Inverts in Kari’s experimental FilterParams tool.

1 Like

The basic premise is to create the first filter so the people matching the filter is true. You have that with your first two filters.

To take people out of that filter; create a filter finding these people. To exclude them, set that filter to Return values that do not match the filter rules.

Then you can combine the filters. Filter 1 has to be true, and those who in filter 2 has to be true. People that are in both these filters will be the people you want.

1 Like

@DaveSch did you mean this? My “Filtered” results are empty now. Something wrong.

The last filter rules should be…

People matching the <filter> Relative
People matching the <filter> Exclude

not

People related to <filter>

1 Like

@emyoulation Im working on Ubuntu. Looks like it work, but it looks strange. All the rules look identical. What do you this is it a bug?

@DaveSch thank you a lot! It works.

It does look strange.

Could you find the custom_filters.xml file in your Gramps User Directory and paste the contents here? (Since you cannot upload an XML type file.)

Sure.

<?xml version="1.0" encoding="utf-8"?>
<filters>
  <object type="Person">
    <filter name="Ancestors" function="or">
      <rule class="IsAncestorOf" use_regex="False">
        <arg value="I0163"/>
        <arg value="1"/>
      </rule>
    </filter>
    <filter name="Descendants of Ancestors" function="or">
      <rule class="IsChildOfFilterMatch" use_regex="False">
        <arg value="Ancestors"/>
      </rule>
      <rule class="IsParentOfFilterMatch" use_regex="False">
        <arg value="Ancestors"/>
      </rule>
      <rule class="IsSiblingOfFilterMatch" use_regex="False">
        <arg value="Ancestors"/>
      </rule>
      <rule class="IsSpouseOfFilterMatch" use_regex="False">
        <arg value="Ancestors"/>
      </rule>
      <rule class="IsDescendantOfFilterMatch" use_regex="False">
        <arg value="Ancestors"/>
      </rule>
      <rule class="MatchesFilter" use_regex="False">
        <arg value="Ancestors"/>
      </rule>
    </filter>
    <filter name="Exclude" function="or" invert="1">
      <rule class="HasTextMatchingSubstringOf" use_regex="True">
        <arg value="Гусаров|Бабуха|Голуб|Здовбель|Моспан|Бондарчук|Гіндін|Гончар|Лисенко|Мазевич|Малишкін|Пилькевич|Пономарьов|Скаржинський|Товарницький|Утевський|Шалдин"/>
        <arg value="0"/>
      </rule>
    </filter>
    <filter name="Filtered" function="and">
      <rule class="MatchesFilter" use_regex="False">
        <arg value="Descendants of Ancestors"/>
      </rule>
      <rule class="MatchesFilter" use_regex="False">
        <arg value="Exclude"/>
      </rule>
    </filter>
  </object>
</filters>
1 Like

Thanks! I’ll check it on my system and submit to @kku if it is a bug.
added:
Display of Filters with multiple rules referencing the same filter · Issue #35 · kkujansuu/gramps · GitHub

1 Like

The “Descendants of Ancestors” filter shows similarly in the FilterParams tool on my Windows system. It omits the rule label when there are multiple rules referencing the same <filter>.

I think it might be related to the way this tool consolidates control of parameters. The intent is to allow users to change all the rules (the ones that use the same parameter) simultaneously. It works fine for String parameters … but not for <filter> parameters.

1 Like

I’m working on it. It is not so easy to fix. As far as I can see this is not related to multiple rules referring to the same filter.

1 Like

There is now a new version of FilterParams that hopefully works better.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.