Recreating a Custom Filters from a multi-stage filter description is a painful and error-prone process.
I’ve found that I can move Custom Filters by appending the XML chunk in the custom_filters.xml in the gramps51 subdirectory of the User Directory.
Actually, you can just trim the closing line from the original XML file and then paste entire custom_filters.xml
file with the 1st two lines removed (not included in the copy&paste buffer). Unfortunately, that duplicates any identically named Custom Filters … yet it only shows the first one in the GUI.
Perhaps the Custom Filters parser could be tweaked to keep reading past the </filters>
and extra XML header? It should probably also overwrite identically named Filters withiin each filter object type.
The intervening lines that have to be deleted when the entire XML custom filter files have been concatenated are:
</filters>
<?xml version="1.0" encoding="utf-8"?>
<filters>
Example: the 5-stage filter in the Wiki example is:
<?xml version="1.0" encoding="utf-8"?>
<filters>
<object type="Place">
<filter name="5-Stage filter A" function="and" comment="Place filter A from the 5-stage FILTERS wiki example">
<rule class="HasData" use_regex="False">
<arg value="il"/>
<arg value="State"/>
<arg value=""/>
</rule>
</filter>
</object>
<object type="Event">
<filter name="5-Stage filter B" function="and" comment="Event filter B from the 5-stage FILTERS wiki example">
<rule class="MatchesPlaceFilter" use_regex="False">
<arg value="5-Stage filter A"/>
</rule>
</filter>
</object>
<object type="Person">
<filter name="5-Stage filter C" function="and" comment="Person filter C from the 5-stage FILTERS wiki example">
<rule class="MatchesEventFilter" use_regex="False">
<arg value="5-Stage filter B"/>
</rule>
<rule class="HasEvent" use_regex="False">
<arg value="Residence"/>
<arg value=""/>
<arg value=""/>
<arg value=""/>
<arg value=""/>
<arg value="0"/>
</rule>
</filter>
<filter name="5-Stage filter D" function="and" comment="Person 5-Stage filter D from the 5-stage FILTERS wiki example">
<rule class="MatchesEventFilter" use_regex="False">
<arg value="5-Stage filter B"/>
</rule>
<rule class="HasEvent" use_regex="False">
<arg value="Death"/>
<arg value=""/>
<arg value=""/>
<arg value=""/>
<arg value=""/>
<arg value="0"/>
</rule>
</filter>
<filter name="5-Stage filter E" function="or" comment="Person 5-Stage filter E from the 5-stage FILTERS wiki example">
<rule class="MatchesFilter" use_regex="False">
<arg value="5-Stage filter C"/>
</rule>
<rule class="MatchesFilter" use_regex="False">
<arg value="5-Stage filter D"/>
</rule>
</filter>
</object>
</filters>