Sort Fact Query on Owner Surname
In a Fact Query the Owner of the Fact is displayed using one of these Column Expressions:
- =FactOwner(%FACT%,1,MALES_FIRST) for Family Fact Husband or Individual Fact Owner.
- =FactOwner(%FACT%,2,MALES_FIRST) for Family Fact Wife (otherwise blank).
- =GetRecord(%FACT%) for Family Fact Husband & Wife record or Individual Fact Owner record.
They all display the name of the owner with forenames first and surname last, so it is not possible to sort them in surname order. The following section explains how to obtain surname sort order.
The following Column Expressions work in FH V5 and above:
- =FieldText(FactOwner(%FACT%,1,MALES_FIRST),'INDI.NAME:SURNAME_FIRST') which displays the surname first, and sorts in surname order, but is NOT an active link to the Individual record.
- =Field(FactOwner(%FACT%,1,MALES_FIRST),'INDI.NAME') which still displays forenames first, but sorts in surname order, and is an active link to the Individual record.
For FH V6 and above, those two Expressions can be combined into one Result Set Column that exhibits the best features of both:
- 1st Column uses Expression: =FieldText(…) with Sort: None and Type: Normal so appears in Result Set.
- 2nd Column uses Expression: =Field(…) with Sort: Ascending and Type: Buddy so is hidden, but defines the sort order of 1st Column and provides an active link.
See the Forum thread:
- Surname first for %FACT%,1,MALES_FIRST 29 Jan 2015