Introduction
The functionA 'function' is an expression which returns values based on computations. Typically, functions require data to be supplied to them as 'parameters'. A function in Family Historian is similar to a 'function' as used in spreadsheet applications (such as MS below will calculate in years the length of a marriage. To compute the end of the marriage is uses the follow datesWhen an Event happened, or an Attrribute was true. in order
- Divorce Date if it exists
- Husband’s Death Date, if it exists and is earlier than the Wife’s Death
- Wife’s Death Date
If there is no marriage date or none of the above exists the function will return a Null (the value of the Wife’s death date)
Details
Join back into one line to use.
=Timespan(%FAM.MARR.DATE%,Dateif(exists(%FAM.DIV.DATE%),%FAM.DIV.DATE%,
Dateif((exists(%FAM.HUSB>DEAT.DATE%)
and (%FAM.HUSB>DEAT.DATE% <= %FAM.WIFE>DEAT.DATE%))
or not(exists(%FAM.WIFE>DEAT.DATE%)),
%FAM.HUSB>DEAT.DATE%,%FAM.WIFE>DEAT.DATE%)),YEARS)
Returns the type of Date e.g. Before After from the second date used. The XDATETYPE will return the type of the date. If you wanted to you could combine the two into a single column on your QueryQuerying is a very powerful feature that allows you to specify and save criteria for identifying a set of records of a given record type. or you might want to show the XDATETYPE for the marriage date as well.
=TextIf(Exists(%FAM.DIV.DATE%),%FAM.DIV.DATE:XDATETYPE%,
TextIf((Exists(%FAM.HUSB>DEAT.DATE%)
and (%FAM.HUSB>DEAT.DATE% <= %FAM.WIFE>DEAT.DATE%))
or Not(Exists(%FAM.WIFE>DEAT.DATE%)),
%FAM.HUSB>DEAT.DATE:XDATETYPE%,%FAM.WIFE>DEAT.DATE:XDATETYPE%))