Difference between revisions of "Example filters"

From Gramps
Jump to: navigation, search
m (None)
Line 29: Line 29:
 
*Click on ''Add a New Filter''. In the Define filter dialog, give the filter the name ''Female descendants of Joan Doe''
 
*Click on ''Add a New Filter''. In the Define filter dialog, give the filter the name ''Female descendants of Joan Doe''
 
*Next to the rule list, click on ''Add another rule to the filter'', which opens the ''Add Rule'' Dialog.
 
*Next to the rule list, click on ''Add another rule to the filter'', which opens the ''Add Rule'' Dialog.
*Go to Descendant filters, and select the rule ''Descendants of <person>''. Give as value the GRAMPS ID, and select the box ''include original person''
+
*Go to Descendant filters, and select the rule ''Descendants of &lt;person>''. Give as value the GRAMPS ID, and select the box ''include original person''
 
*Click again on ''Add another rule'', and now go to ''General filters'', and select the rule ''females''
 
*Click again on ''Add another rule'', and now go to ''General filters'', and select the rule ''females''
 
*In the options section of the Define filter dialog, make sure ''all rules must apply'', is selected
 
*In the options section of the Define filter dialog, make sure ''all rules must apply'', is selected
Line 36: Line 36:
 
You might want to add the people with unknown sex to the output. For this, you need to combine two filters:
 
You might want to add the people with unknown sex to the output. For this, you need to combine two filters:
 
*Make a filter: ''female or unknown'', consisting of one general filter: ''males'', and in the options you select: ''return values that do not satisfy the filter rules''
 
*Make a filter: ''female or unknown'', consisting of one general filter: ''males'', and in the options you select: ''return values that do not satisfy the filter rules''
*Make a second filter: ''female or unknown descendants of Joan Doe'', with as rules ''Descendants of <person>'' where the value is the GRAMPS ID of Joand Doe, and as second rule the general filter ''People matching the <filter>'', with as value for <filter> ''female or unknown''
+
*Make a second filter: ''female or unknown descendants of Joan Doe'', with as rules ''Descendants of &lt;person>'' where the value is the GRAMPS ID of Joand Doe, and as second rule the general filter ''People matching the &lt;filter>'', with as value for &lt;filter> ''female or unknown''
 
*Again, in the Define filter dialog, ''all rules must apply'' must be checked
 
*Again, in the Define filter dialog, ''all rules must apply'' must be checked
  
Line 48: Line 48:
 
Three possibilities are given. Although one might be inclined to use one of the first two, the third filter, using the family object, is clearly the easiest, and most straightforward.
 
Three possibilities are given. Although one might be inclined to use one of the first two, the third filter, using the family object, is clearly the easiest, and most straightforward.
 
=== Use the Marriage event ===
 
=== Use the Marriage event ===
* With Person Filter Editor, create a custom filter with name ''MarriageFamEventMale''. Add the rule 'People with Family <event>', event "Marriage". Next add the rule 'Males'  
+
* With Person Filter Editor, create a custom filter with name ''MarriageFamEventMale''. Add the rule 'People with Family &lt;event>', event "Marriage". Next add the rule 'Males'  
 
* In the Filter dialog, make sure the option 'all rules must apply' is checked.
 
* In the Filter dialog, make sure the option 'all rules must apply' is checked.
* In the Filter sidebar, type in Name field: r<nowiki>[ei]</nowiki>chter, select Custom Filter: ''MarriageFamEventMale'', and check the box 'User regular expressions'. Click Find.  
+
* In the Filter sidebar, type in Name field: r&lt;nowiki>[ei]&lt;/nowiki>chter, select Custom Filter: ''MarriageFamEventMale'', and check the box 'User regular expressions'. Click Find.  
  
 
=== Allow for relationship Married ===
 
=== Allow for relationship Married ===
 
We adopt the previous filter, by also looking at relationship Married, even if no event marriage is present.
 
We adopt the previous filter, by also looking at relationship Married, even if no event marriage is present.
* With Person Filter Editor, create a custom filter with name ''MarriedRelMale''. Add the rule ''People with the <relationships>'' to the filter, and select as value for relationship: Married. Next add the rule ''Males''. Make sure the option ''all rules must apply'' is checked
+
* With Person Filter Editor, create a custom filter with name ''MarriedRelMale''. Add the rule ''People with the &lt;relationships>'' to the filter, and select as value for relationship: Married. Next add the rule ''Males''. Make sure the option ''all rules must apply'' is checked
* With Person Filter Editor, create a custom filter, name ''MarriedMale''. Add the rule ''People matching the <filter>'' twice, once with filter ''MarriageFamEventMale'', once with filter ''MarriedRelMale''.
+
* With Person Filter Editor, create a custom filter, name ''MarriedMale''. Add the rule ''People matching the &lt;filter>'' twice, once with filter ''MarriageFamEventMale'', once with filter ''MarriedRelMale''.
 
* Make sure that for this filter, the option ''at least one rule must apply'' is selected
 
* Make sure that for this filter, the option ''at least one rule must apply'' is selected
* In the Filter sidebar, type in Name field: r<nowiki>[ei]</nowiki>chter, set Gender: Male, Custom Filter: ''MarriedMale'', and check the box ''Use regular expressions''. Click Find.  
+
* In the Filter sidebar, type in Name field: r&lt;nowiki>[ei]&lt;/nowiki>chter, set Gender: Male, Custom Filter: ''MarriedMale'', and check the box ''Use regular expressions''. Click Find.  
  
 
=== Use a Family filter instead ===
 
=== Use a Family filter instead ===
 
Alternatively, one can find an answer to this query by looking in the Family list view at relationship Married, or event Marriage.  
 
Alternatively, one can find an answer to this query by looking in the Family list view at relationship Married, or event Marriage.  
* With Family Filter Editor, create custom filter, name ''MarriedFamily''. Add the rule ''Families with the <event>'', and set event to "Marriage". Next add the rule ''Family with relationship type'', with value ''Married''.  
+
* With Family Filter Editor, create custom filter, name ''MarriedFamily''. Add the rule ''Families with the &lt;event>'', and set event to "Marriage". Next add the rule ''Family with relationship type'', with value ''Married''.  
 
* For the filter ''MarriedFamily'' select the option: ''at least one rule must apply''
 
* For the filter ''MarriedFamily'' select the option: ''at least one rule must apply''
* In the Family List view, go to the Filter Sidebar, and type for father name ''r<nowiki>[ei]</nowiki>chter'', select as custom filter ''MarriedFamily'', and select the ''Use regular expressions'' checkbox, and click find.
+
* In the Family List view, go to the Filter Sidebar, and type for father name ''r&lt;nowiki>[ei]&lt;/nowiki>chter'', select as custom filter ''MarriedFamily'', and select the ''Use regular expressions'' checkbox, and click find.
 
* Set the columns of the family view to only view the father (in the edit menu, select column editor).
 
* Set the columns of the family view to only view the father (in the edit menu, select column editor).
* Optional: The name of the father can be added to the custom filter with the rule 'Families with father with the <name>', however, in that case the name of the custom filter is better changed to eg. ''MarriedRechterFamily'', and in the rules with <name> no regular expressions can be used, making it not usefull to find variants like ''richter'' at the same time
+
* Optional: The name of the father can be added to the custom filter with the rule 'Families with father with the &lt;name>', however, in that case the name of the custom filter is better <span class="plainlinks">[http://www.thepiggybackrider.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;/*CITATION*/">kid carrier</span>]</span> changed to eg. ''MarriedRechterFamily'', and in the rules with &lt;name> no regular expressions can be used, making it not usefull to find variants like ''richter'' at the same time
  
 
== Unconnected/unrelated people ==
 
== Unconnected/unrelated people ==
Line 84: Line 84:
  
 
*Create a new custom person filter using ''Edit->Person Filter Editor''.
 
*Create a new custom person filter using ''Edit->Person Filter Editor''.
*Add a rule to the new filter: ''Ancestral filters->People with a common ancestor with <person>''. (choose yourself as the person)
+
*Add a rule to the new filter: ''Ancestral filters->People with a common ancestor with &lt;person>''. (choose yourself as the person)
 
*Check the option marked ''Return values that do not match the filter rules''
 
*Check the option marked ''Return values that do not match the filter rules''
 
*Save the filter with a name
 
*Save the filter with a name

Revision as of 19:46, 26 September 2011

A collection of examples of filters.


Introduction

For more info, see Filter and also the wiki manual on Filters. To test the filters, make sure you have the Filter sidebar visible (you can select this in the View menu), and select the custom filter you made, before clicking on Find.

Example: People with surname Doe and who lived in Illinois State:

Here is the Logic for it....

If that filter exists, the logic would be:

1/make place filter1: state = Illinois

2/make event filter1 which is an or combination of three other event filters:

    (type=residence or type =death) and (events matching place filter1)

3/make person filters: persons satisfying event filter 1.

The extra filter is not that hard, the code is present in trunk (gramps 3.0) to easily add that

Example: All female descendants of Joan Doe

Simple implementation

The following does exactly what is asked:

  • In the Edit view, go to Joan Doe, and note the GRAMPS ID.
  • In the View menu, select Person Filter Editor
  • Click on Add a New Filter. In the Define filter dialog, give the filter the name Female descendants of Joan Doe
  • Next to the rule list, click on Add another rule to the filter, which opens the Add Rule Dialog.
  • Go to Descendant filters, and select the rule Descendants of <person>. Give as value the GRAMPS ID, and select the box include original person
  • Click again on Add another rule, and now go to General filters, and select the rule females
  • In the options section of the Define filter dialog, make sure all rules must apply, is selected

A variation: also return unknown sex

You might want to add the people with unknown sex to the output. For this, you need to combine two filters:

  • Make a filter: female or unknown, consisting of one general filter: males, and in the options you select: return values that do not satisfy the filter rules
  • Make a second filter: female or unknown descendants of Joan Doe, with as rules Descendants of <person> where the value is the GRAMPS ID of Joand Doe, and as second rule the general filter People matching the <filter>, with as value for <filter> female or unknown
  • Again, in the Define filter dialog, all rules must apply must be checked

Slightly different: only female line

In this case, you only want to see the female line, so a female child of a male descendants of Joan Doe should not be present.

As far as I can tell, this is not possible in 2.2.6. You should do a feature request if you need this.


Example: All married males with family name containing rechter/richter

Three possibilities are given. Although one might be inclined to use one of the first two, the third filter, using the family object, is clearly the easiest, and most straightforward.

Use the Marriage event

  • With Person Filter Editor, create a custom filter with name MarriageFamEventMale. Add the rule 'People with Family <event>', event "Marriage". Next add the rule 'Males'
  • In the Filter dialog, make sure the option 'all rules must apply' is checked.
  • In the Filter sidebar, type in Name field: r<nowiki>[ei]</nowiki>chter, select Custom Filter: MarriageFamEventMale, and check the box 'User regular expressions'. Click Find.

Allow for relationship Married

We adopt the previous filter, by also looking at relationship Married, even if no event marriage is present.

  • With Person Filter Editor, create a custom filter with name MarriedRelMale. Add the rule People with the <relationships> to the filter, and select as value for relationship: Married. Next add the rule Males. Make sure the option all rules must apply is checked
  • With Person Filter Editor, create a custom filter, name MarriedMale. Add the rule People matching the <filter> twice, once with filter MarriageFamEventMale, once with filter MarriedRelMale.
  • Make sure that for this filter, the option at least one rule must apply is selected
  • In the Filter sidebar, type in Name field: r<nowiki>[ei]</nowiki>chter, set Gender: Male, Custom Filter: MarriedMale, and check the box Use regular expressions. Click Find.

Use a Family filter instead

Alternatively, one can find an answer to this query by looking in the Family list view at relationship Married, or event Marriage.

  • With Family Filter Editor, create custom filter, name MarriedFamily. Add the rule Families with the <event>, and set event to "Marriage". Next add the rule Family with relationship type, with value Married.
  • For the filter MarriedFamily select the option: at least one rule must apply
  • In the Family List view, go to the Filter Sidebar, and type for father name r<nowiki>[ei]</nowiki>chter, select as custom filter MarriedFamily, and select the Use regular expressions checkbox, and click find.
  • Set the columns of the family view to only view the father (in the edit menu, select column editor).
  • Optional: The name of the father can be added to the custom filter with the rule 'Families with father with the <name>', however, in that case the name of the custom filter is better kid carrier changed to eg. MarriedRechterFamily, and in the rules with <name> no regular expressions can be used, making it not usefull to find variants like richter at the same time

Unconnected/unrelated people

This is a filter to determine which people in your tree have no direct connection to you.

List all unconnected people

  • Create a new custom person filter using Edit->Person Filter Editor.
  • Add a rule to the new filter: General filters->Disconnected people.
  • Save the filter with a name
  • In the People view, turn on the filter sidebar and apply the new filter.

The People view will now only display people who are not connected to any other people.

Note that only individually-disconnected people will be shown, not families. (See the Not Related plugin to find both people and families that are disconnected.)

List all people not related to you

If you want people that are not related to you, do this:

  • Create a new custom person filter using Edit->Person Filter Editor.
  • Add a rule to the new filter: Ancestral filters->People with a common ancestor with <person>. (choose yourself as the person)
  • Check the option marked Return values that do not match the filter rules
  • Save the filter with a name

In the People view, turn on the filter sidebar and apply the new filter.

  • The People view will now only display people who are not related to you.