Page 1 of 1
How to set a flag based upon age at death?
Posted: 12 Mar 2013 15:03
by wulliam
I would like to have a way of:
1) adding a flag called, say, 'died young' to everyone in my file who died before their 14th birthday, and
2) having the same flag added automatically if appropriate whenever I enter anyone's date of death..so that I don't have to think it through each time.
I'm sure it's possible - probably easy - but I don't know how [frown]
Thanks for taking the time to read this!
ID:6830
How to set a flag based upon age at death?
Posted: 12 Mar 2013 15:15
by tatewise
It depends on how you plan to use the
Flag.
But in most cases it is better to use an
Expression in the scenarios where you need the information, e.g. Diagram Icon, or Records Window Column, or Query Filter.
The advantage of an
Expression is that it is
automatic.
See
Using Flags and Icons that shows how to use automatic
Expressions instead of manually added
Flags.
The sort of
Expression you would need is:
=IsTrue( %INDI.DEAT.DATE:AGE_AT% < 14 )
How to set a flag based upon age at death?
Posted: 12 Mar 2013 15:32
by wulliam
That works really nicely Tatewise - and more than, that, I can see how it works!
Thanks very much - off to play some more!
How to set a flag based upon age at death?
Posted: 12 Mar 2013 15:47
by tatewise
A slightly more sophisticated Expression that works in more scenarios is:
=IsTrue( AgeAt(%INDI%,EstimatedDeathDate(%INDI%, EARLIEST, 2) ) < 14 )
where EARLIEST can be LATEST or MID and the 3rd numerical parameter specifies how many generations up & down to inspect when necessary to formulate the estimate.
If actual DATE or AGE is given then of course that takes precedence.
See the FH Help on Functions.
How to set a flag based upon age at death?
Posted: 12 Mar 2013 16:07
by wulliam
OK, I've had a play and managed to get the following working:
=IsTrue(%INDI.BURI[1].DATE:YEAR% - %INDI.BAPM[1].DATE:YEAR% <14 or %INDI.BURI[1].DATE:YEAR% - %INDI.BIRT[1].DATE:YEAR% <14 or %INDI.DEAT[1].DATE:YEAR% - %INDI.BAPM[1].DATE:YEAR% <14 or %INDI.DEAT[1].DATE:YEAR% - %INDI.BIRT[1].DATE:YEAR% <14)
...the idea being that I sometimes know one of birth/baptism and one of death/burial. Is there a more efficient way to do what I've managed there?
...I've just seen your more sophisticated expression - thanks for that though I'm not after an estimate - I want to highlight those people who (almost) certainly never married or had children.
How to set a flag based upon age at death?
Posted: 12 Mar 2013 16:17
by johnmorrisoniom
I use several expressions in diagrams to show an appropriate icon.
One of the expressions is:
Code: Select all
=IsTrue((AgeAt(%INDI%,%INDI.DEAT.DATE%) <= 5) and (AgeAt(%INDI%,%INDI.DEAT.DATE%) >= 1))
This is for someone who died aged between 1 & 5.
I use similar expressions, just modifying the numbers to show different Icons for:
0-1
6-12
13-20
21-30
31-40
etc.... and eventually 100+
My thanks to Mike Tate for helping me get it working.
How to set a flag based upon age at death?
Posted: 12 Mar 2013 17:56
by wulliam
John - that's an interesting idea which I'll give some thought to!
How to set a flag based upon age at death?
Posted: 12 Mar 2013 22:19
by tatewise
Wulliam ~ I believe the EstimatedDeathDate() function does give an accurate Date if your data has an actual Date or Age for Death or Burial Event.
If the 3rd Generations parameter is 0 then I suspect it looks no further.
Also I believe the AgeAt() function will use a Date from a Birth or Baptism or Christening Event.
Furthermore, by comparing EARLIEST with LATEST versions you can determine the accuracy.
Checkout the Help on Functions and perform a few experiments, perhaps on the Family Historian Sample Project before discounting the AgeAt( %INDI%, EstimatedDeathDate( %INDI%, ... ) ) option.
Maybe =IsTrue( AgeAt(%INDI%,EstimatedDeathDate(%INDI%, LATEST, 0) ) < 14 ) will do what you want.
Re: How to set a flag based upon age at death?
Posted: 03 May 2016 05:03
by bp158
Thank you for this. I used it to colour the text of those who died young.