Report Filters
(Note: This was written for TMG v4.x although the principles also apply to TMG v5.x and v6.x.)
The Focus tab of most reports allow you to choose one of two or three basic options: All Persons, Person Number, Prompt When Generated, some variation of these, or Filtered Group. The Filtered Group is where most users have a problem. That is, new users often experience minor problems trying to generate reports in TMG when they don't want a report for a single person or for all people. Some of the problem is aggravated by the fact the certain reports seem, at first, to act differently than others. So we'll discuss the different type reports first.
TMG produces list, ancestral and descendancy reports. Descendancy reports (and similarly, the ancestral) reports include data on a person and their descendants. These reports thus produce many pages of data on many persons with just one person number. List reports may or may not contain much data if you only ask for data for a single person number. Thus if the Focus of a descendancy report is for your great-grandfather, then the report will start with him and then include his children (including your grandfather), their children (including your father), and then their children (including you), etc.
Now if you set the Focus for a descendancy report to be your great-grandfather and his descendants, then you would get one report starting with each person passing your Focus filter. So, if your great-grandfather had two children, and each child had two children, and each grandchild had two children, then he would have 14 descendants and thus TMG would generate 15 reports. There would be a report for your great-grandfather (and his descendants), the second and third reports would be for your grandfather/mother and for your grand aunt/uncle (and their descendants), next would be reports for your mother/father and aunt/uncle and their first cousins (and their descendants), and finally would be reports for yourself and your sibling and cousins.
On the other hand, list reports are designed to report data for each person, and not to include (by definition) anyone else. Thus you have to keep in mind the design of the report when designing the filter for the report. So if you want to generate a descendants report for your great-grandfather, you would would probably use the Person Number or Prompt When Generated Focus options.
But if you want a list of your great grandfather and all his descendants showing their
birth dates, then you would choose to generate a List of People report with a Focus filter
of:
ID Number
Equals
[?]
END
and would mark the bottom to:
And then add
their:
[X] Descendants for [250] generations
You may also want to include Spouses in the bottom line.
The "[?]" above is a special variable that tells TMG to ask for the specific target data when the report is generated. This allows you to create one report definition that may be used often for different persons. Thus (in the above case), you could rerun the same report again and generate a different list each time depending on the ID Number that you enter.
With Spouses selected above, the above filter will result in a listing
that will include your great grandparents and their descendants. If you
want the spouses of those descendants then you need to do a little more work.
You would use the above filter and the Secondary Output tab of the List of
People report to set a Custom Flag. Then you would create another List of
People report with a filter like (assuming the name of the Custom Flag is
"Custom"):
CUSTOM
Flag
Equals
Y
END
and would mark the bottom to:
And then add
their: [X]
Spouses
This would result in the listing of all those in the upper report plus their spouses.
Now let's assume that you want a list of birth dates for each of your oldest ancestors and all their descendants. This would require something more than just a couple of filter lines because it will require that you first identify the oldest ancestors. But it is a fairly easy filter once you get used to filter design. To identify your oldest ancestors, you might use a filter like this:
Is an Ancestor of Person Number [?] AND 507 Father* ID# Equals 0 AND 9670 Mother* ID# Equals 0 END 11166
The numbers displayed in red at the end of each filter line above indicates what the Filter Progress Screen showed when I ran the report. The combination of the three filter lines gave 218 persons. These are then my oldest ancestors.
Now if I want all the birth dates for them and all their descendants, all I have to do
is select at the bottom of the Focus tab:
And then add their:
[X] Descendants for [250] generations.
This adds 10043 persons to my list for a total of 10261 persons.
The main thing here in writing filters is to define for yourself exactly who you want to include in the report. Write that definition down. If you think it doesn't include too many or too few, try it with the Destination of the Screen. If the results on the Screen appear to be correct, you can then print it or re-run the report to a File for use in your word processor.
But, if the result isn't exactly what you want, see if you can determine what is wrong. That is, is the filter too strict or too loose. Filters are based on logical arguments. Rarely you will have ones that are somewhat complex with many lines separated by ANDs and ORs with the occasional Parentheses setting off certain lines or groups of lines. If you are familiar with boolean algebra, you won't have any trouble at all. However, that is not a subject about which you have to be knowledgeable and is easily learned fairly quickly -- at least to the extent needed for TMG.
Very rarely, you may come across a situation in which a single filter cannot be designed. In those cases, you will need to run multiple reports before the final result is achieved. When this is necessary, you will need to create one or more custom Flags and run the List of People report with appropriate filters. Then TMG will set the Flags using the Secondary Output of the List of People report.
For example, suppose that you want to create a GEDCOM to send to a cousin that doesn't have TMG. But because you don't want to send your entire dataset, you define what you want to send. Suppose that includes all of one of your direct lines down to you plus the your cousin's direct line and both lines back to a common ancestor . In addition to this, you want to include all children of each descendant of the common ancestor.
The following steps need to be taken to get the result above:
The filter that you would want to use for setting the flag would be something like the following filter in the Focus tab of a List of People report::
( ID Number Equals [?] OR 10 Is an Ancestor of Person Number [?] AND 10 Is a Descendant of Person Number [?] ) OR 396 ( ID Number Equals [?] OR 741 Is an Ancestor of Person Number [?] AND 741 Is a Descendant of Person Number [?] ) OR 396 ID Number Equals [?] END 396
At the bottom, you would also select to include [X] Spouses.
When you generate the report, TMG will ask you to enter the ID Numbers for the persons
noted in the filter. If we assume the following ID Numbers:
You
10
Your Cousin
741
Your common ancestor 396
then you will enter the numbers as shown in red above. This filter will then select
you and your ancestors who are descendants of your common ancestor. It will also
select your cousin, their ancestors who are descendants of the common ancestor. It will
also select the common ancestor, and finally it will select all spouses of all persons
selected.
When you are satisfied that you are getting the right selection of persons (you may want to generate the report to screen or printer and review the results), then select the Secondary Output tab and choose the Change Flag1 flag to Y option before generating the report for the final time. This time, you may wish to suppress the display or printing of the report which you can select on the General tab under Screen Destination option.
When the report has finished generating, it will ask if you want to change the flag for the persons selected. Answer Yes if you are ready. TMG will also ask if you want to change the Last Edited Date -- which I usually say No, but it is up to you.
Now you need to use the results of this in a second List of People report to create
your new dataset. You would select the Create New Dataset option from the Secondary
Out put tab. The Focus filter now will be something like this:
*
FLAG1
Equals
Y
END
and at the bottom of the screen, select: [X]
Descendants for 1 generations.
The above filter will select all those from the previous report for which the flag was changed and will add all their children. If you don't want your children, those of your siblings, your cousin's children or their siblings children, then you may want to run this filter to change the flag for the results of this run to Y (rather than create the new dataset at this time). Then you can either manually change the flag to N or run a List of People report to select those persons and let TMG change the flag back to N.
If you do this, you will want to run a List of People report with the Secondary Output
Create a New Dataset option using only those persons with the flag set to Y. Then
the filter will be like this:
FLAG1
Equals
Y
END
and at the bottom of the screen, de-select all options.
Now, you may want the spouses of all persons finally selected. Again you can let
TMG change the flags of those persons or you can change them manually, whichever is easier
and quicker for you. Probably the easiest would be to use the filter above
(marked with a red asterisk) to change the flag to Y (rather than create the dataset).
Then run a final List of People report using the Secondary Output Create New
Dataset option with a filter of::
FLAG1
Equals
Y
END
and at the bottom of the screen, select [X] Spouses.
When all reports have been generated, and the new dataset has been generated, open the new dataset. Now, generate the GEDCOM selecting all persons for export. The result should be as you wish.
It is hoped that the above examples will give you an idea of how to design filters for your needs. Some of the examples are a bit contrived in order to show what can be done. Still these are valid possibilities of what someone may want to use at some point either as is or with some changes.
If the examples here are still a little confusing, I recommend that you try them using your own data. If the results don't quite give the results you expect, try changing the filter lines in small ways to see if that doesn't give results that you think better.
Finally, you may find that you can develop filters that are more efficient than the examples above. I expect that there may be more efficient filters than the ones I use in the examples. If you do develop better filters, maybe I have done what I set out to do -- make you more comfortable with filters.
Comments to: Lee Hoffman
Return to the TMG Tips Tutorial Page