Functions (all)

FactText

Function Name:
FactText

Description:
This function is typically used in diagram text schemes. It allows you to output fact information (that is, event or attribute information) and to control the way the information is presented and formatted.  You specify whether to include date and place details, and if so, in what format.    You can specify how to combine the two items of text (date and place) by adding an optional prefix and/or suffix.  You can also optionally supply text to separate date and place details if both exist, and you can optionally supply alternative text to use if both place and date are empty.

See also CombineText_AB, CombineText, ExistsText, NotExistsText and ForceText.

Minimum FH Version:
7

No. of Parameters:
3

Return Type:
Text

Parameter 1:
The data item.  This must be a Family Historian fact (i.e. an event or attribute).

Parameter 2:
A string specifying the required options.  This string consists of 1, 2 or 3 characters - e.g. "C", "CT" or "CTA".

The first character specifies the format required for the date and has the following meaning:

Value Date Format
Y Year
L Long
C Compact
1 Abbrev
2 Abbrev (2)
3 Abbrev (3)
4 Abbrev (4)
0 Exclude date details

The second character, if any, specifies the format required for the place. No second character means exclude the place. If supplied though it has the following meaning:
Value Place Format
S Short
M Medium
T Tidy
F Full
0 Exclude place details

Finally the third character, if supplied, must be 'A'. This means always output the prefix - if the fact exists, whether or not there is any value, date or place information.
Parameter 3:
A format string.  There are two variants of the format string - the 'Event' variant and the 'Attribute' variant.

If the Event variant is used, date and place text (if any) will be output in that order.  The Event variant has up to 4 sections.  It starts with a letter 'E' (upper-case) followed by a separator character (the underscore '_' is used in the examples)  that will be used to separate out the remaining sections of the format string. The remaining sections are as follows:

section 1 Prefix to be output if either date or place are not empty (or if the fact exists and always output the prefix is true - see Parameter 2)
section 2 Separator to be output if both date and place are not empty
section 3 Suffix to be output if either date or place are not empty
section 4 Alternative text to be output if both date and place are empty

All sections are optional, and default to an empty string, if not supplied.  For example, the format string for the birth event might look like this: "E_Born: _ in ".   This will create a string prefixed with "Born: " if either date or place text exists.  If both date and place text exist, they will be separated by " in " (section 2).  Finally, there is no section 3 or 4, so there is no suffix, and no text at all will be output if both date and place are empty.

If the Attribute variant is used, value (i.e. the value of the attribute), date and place text (if any) will be output in that order.  The Attribute variant has up to 5 sections.  It starts with a letter 'A' (upper-case) followed by a separator character (again, the underscore '_' is used in the examples) that will be used to separate out the remaining sections of the format string. The remaining sections are as follows:

section 1 Prefix to be output if value or date or place are not empty (or if the fact exists and always output the prefix is true - see Parameter 2)
section 2 Separator to be output if both value and date are not empty
section 3 Separator to be output if either value or date or both are not empty, and place is not empty
section 4 Suffix to be output if value or date or place are not empty
section 5 Alternative text to be output if value, date and place are all empty

Again, all sections are optional, and default to an empty string, if not supplied.  For example, the format string for the occupation event might look like this: "A_Occupation: _, _ in _".   This will create a string prefixed with "Occupation: " if a value for the occupation has been supplied, or if either date or place text exists.  If both a value and date text exists, they will be separated by a comma.  If either value or date exist, and if place text also exists, they will be separated by " in ".  Finally, no text at all will be output if value, date and place are all empty.

Both variants can be used with either events or attributes.  The 'value' for an event is always an empty string.

Examples:

=FactText(%INDI.BIRT%,"CTA","E_Born: _ in _")

=FactText(%INDI.OCCU%,"CT","A_Occupation: _, _ in _")