Family Functions

EVENT marriage(FAM);

first marriage event of

INDI husband(FAM);

first husband/father of

INDI wife(FAM);

first wife/mother of

INT nchildren(FAM);

number of children in

INDI firstchild(FAM);

first child of

INDI lastchild(FAM);

last child of

STRING key(FAM|INDI, [BOOL]);

internal key of (works for persons also)

NODE fnode(FAM);

root GEDCOM node of

NODE root(FAM);

root GEDCOM node of

FAM fam(STRING);

find family from key

FAM firstfam(void);

first family in database in key order

FAM nextfam(FAM);

next family in database in key order

FAM prevfam(FAM);

previous family in database in key order

children (FAM, INDI_V, INT_V) { commands }

loop through children of family

forfam (FAM_V, INT_V) { commands }

loop through all families in database

These functions take a family as an argument and return information about it.

Marriage returns the first marriage event found in the family record, if any; it returns null if there is no marriage event.

Husband returns the first husband/father of the family, if any; and wife returns the first wife/mother of the family, if any. Each returns null if the requested person is not in the family.

Nchildren returns the number of children in the family.

Firstchild and lastchild return the first child and last child in a family, respectively.

Key was described in the section on person functions.

Root and fnode return the root node of a family GEDCOM node tree. Note that a FAM value is not a NODE value. If you want to process the nodes within a family node tree, you must first use root or fnode function to get the root of the family node tree. Root and fnode are synonyms.

Fam returns the family who’s key is passed as an argument; if no family has the key fam returns null.

Firstfam, nextfam and prevfam allow you to iterate through all families in the database. Firstfam returns the first family in the database in key order. Nextfam returns the next family after the argument family in key order. Prevfam returns the previous family before the argument family in key order.

Children is an iterator that loops through the children in a family. Its first parameter is a family expression; its second parameter is a variable that iterates through each child; its third parameter is an integer counter variable that counts the children starting at one. These two variables may be used within the loop body.

Forfam is an iterator that loops through every family in the database in ascending key order. Its first parameter is a variable that iterates through the families; its second parameter is an integer counter variable that counts the families starting at one.