Advanced Topics

Understanding Functions

This topic is for advanced and technically-minded users only.

There is no need for any user to ever learn or know anything about functions. However, for users who wish to know, this help topic provides some information about them.

A '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 Excel), macro languages used in Office applications (such as Visual Basic for Applications, used in MS Word), or programming languages. An example of a function in Family Historian is the 'Relationship' function. If you pass this function identifiers for 2 individuals, the function will tell you how they are related. See below for more details.

Expressions which represent functions begin with an '=' (e.g. "=RecordId()"). Functions can also be passed as parameters to other functions. When this occurs, do not put an ‘=’ sign in front of the function which is being used as a parameter. For example, “=Relationship(FileRoot())” returns the current records relationship to the file root.

When using functions in the context of queries, you can often put a quoted string in square brackets as a parameter - e.g. ["Individual"]. This is called a Prompt. When the query is run, Family Historian will display a dialog and prompt you to display a value for this item, labelled "Individual" in the dialog. You cannot however do this in diagrams or reports. See Prompts for more on this.

Functions and other expressions can be used in Queries, Diagrams, Reports and Books.

Many function expressions can be created by simply putting an ‘=’ in front of the function name, and two round brackets on the end of it. For example, ‘=ChildCount()’, ‘=RecordId()’, ‘=LastUpdated()’ are all valid expressions. These functions all take one parameter. However, if no parameter is supplied, Family Historian will assume that the current record should be used. The meaning of the 'current record' is context dependent. In a query, it will be the record for the current row in the result set. In a report, it may be the current entry record; or, if used within a section, that relates to a particular record, it may the record associated with that section.

For a complete list of functions in Family Historian see Functions (all).

For a list of functions that were added in version 7.0, see New Functions (added in 7.0).

Some functions are more complex than others, and may take several parameters. If you wish to use any of these functions, it may help to look for an example of a standard query that uses them, and try to copy what it does.

Note: occasionally you may see functions referred to as built-in functions.  This is to distinguish them from the functions made available to plugin authors, by the Family Historian API.