Page 1 of 1

Expression for file roots wife

Posted: 04 Feb 2020 16:17
by jelv
I have a query of type fact which is currently showing the Ahnentafel Number of the owner of the selected events (census) relative to myself (I'm file root).

Column expression =AhnentafelNumber(FileRoot(),GetRecord(%FACT%),1)

That works as expected.

I'd like to add a column to show the Ahnentafel Number relative to my wife (there would be a number on one or other, or both would be blank). Everything I've tried gives an error when I try to update. This is my latest attempt:

=AhnentafelNumber(getrecord(%CUR_FILE_ROOT.~SPOU[1]>%),GetRecord(%FACT%),1)

which gives the error "Invalid expression for the current query type.". Can someone give me the correct expression to achieve what I want please?

(If I add a column %CUR_FILE_ROOT.~SPOU[1]>% to correctly shows my wife so that is valid in the current query type)

Re: Expression for file roots wife

Posted: 04 Feb 2020 17:03
by Jane
Give

Code: Select all

=AhnentafelNumber(GetField(FileRoot(),"%INDI.~SPOU>%"),GetRecord(%FACT%),1)
a try

Re: Expression for file roots wife

Posted: 04 Feb 2020 22:12
by jelv
Magic! Thankyou.

The query I've been working on is to help me check I've put all the entries on to Lost Cousins for both myself and my wife. You enter a census year (usually 1841,1881 or 1911) and it lists all the individuals with census events for the selected year. It also gives the age entered against that census event.

For females it shows the surname of the spouse as that is what would have to be entered on Lost Cousins.

I'm using Ancestral Sources, so the reference is the Ref. Id which I enter piece/folio etc. as appropriate to the census (this is Publication Information in the source).

Date, References, Individual and Age are all working links.

Code: Select all

[Family Historian Query]
VERSION=3.0
TYPE=FACT
DESC=
List of all individuals with census entries for a given year with the infor
mation required when adding peiople to LostCousins.
.
TITLE="Census list for year with ancestor relationship numbers (A.No. for root A.No.Sp. for spouse of root)"
SUBTITLE="%#x"
ORIENTATION=LANDSCAPE
TAG="Date","FACT.DATE:YEAR",,,23
TAG="References","FACT.SOUR>PUBL",,ASC,80
TAG="Age","FACT.AGE",HIDDEN,DESC,80
TAG="Individual","=FieldText(GetRecord(%FACT%),'INDI.NAME:SURNAME_FIRST')",,,105
TAG="Individual link","=Field(GetRecord(%FACT%),'INDI.NAME')",BUDDY,ASC,80
TAG="Spouse","=TextIf(Sex(GetRecord(%FACT%),""M"",""F"","""") = ""F"",FieldText(GetRecord(%FACT%),'INDI.~SPOU>NAME:SURNAME'),"""")",,,61
TAG="Age","FACT.AGE",,,30
TAG="Gender","=Sex(FactOwner(%FACT%,1,MALES_FIRST),""male"",""female"","""")",,,33
TAG="A. No.","=AhnentafelNumber(FileRoot(),GetRecord(%FACT%),1)",,,27
TAG="A. No. Sp.","=AhnentafelNumber(GetField(FileRoot(),""%INDI.~SPOU>%""),GetRecord(%FACT%),1)",,,40
TAG="Relationship","=Relationship(FileRoot(),GetRecord(%FACT%),TEXT,1)",,,157
FILTER=GEN,ADD,IF,N,"","=FactLabel(%FACT%)",,"=",TEXT,"Census"
FILTER=GEN,EXC,UNLESS,Y,"Census Year","FACT.DATE:YEAR",,"=",NUMBER,1881

Re: Expression for file roots wife

Posted: 04 Feb 2020 22:32
by jelv
I've also, using Query:Individual ~ Ages on Census Produced by brianh as a starting point, created a query to list all individuals with census entries, showing the age given at each census. If there is a census entry without an age it shows "???". As it only has one column for each census (the original had two) I find it easier to spot the missing census, or mssing ages.

Code: Select all

[Family Historian Query]
VERSION=3.0
TYPE=INDI
DESC=
List of all individuals with census events showing their age as recorded in
 census.
.
DESC=

.
DESC=
If there is a census event but the age has not been recorded for that censu
s it shows "???".
.
DESC=

.
DESC=
(This is based on Query:Individual ~ Ages on Census Produced by brianh)
.
TITLE="Ages of individuals at times of census"
SUBTITLE="%#c"
ORIENTATION=LANDSCAPE
TAG="Individual","INDI",,ASC,120
TAG="ID","=RecordId()",,,30
TAG="Birth","INDI.BIRT.DATE:YEAR",,,34
TAG="Death","INDI.DEAT.DATE:YEAR",,,40
TAG="1841","=TextIf(Exists(%INDI.CENS[year=1841].AGE%),%INDI.CENS[year=1841].AGE%,TextIf(Exists(%INDI.CENS[year=1841]%),""???"",""""))",,,32
TAG="1851","=TextIf(Exists(%INDI.CENS[year=1851].AGE%),%INDI.CENS[year=1851].AGE%,TextIf(Exists(%INDI.CENS[year=1851]%),""???"",""""))",,,32
TAG="1861","=TextIf(Exists(%INDI.CENS[year=1861].AGE%),%INDI.CENS[year=1861].AGE%,TextIf(Exists(%INDI.CENS[year=1861]%),""???"",""""))",,,32
TAG="1871","=TextIf(Exists(%INDI.CENS[year=1871].AGE%),%INDI.CENS[year=1871].AGE%,TextIf(Exists(%INDI.CENS[year=1871]%),""???"",""""))",,,32
TAG="1881","=TextIf(Exists(%INDI.CENS[year=1881].AGE%),%INDI.CENS[year=1881].AGE%,TextIf(Exists(%INDI.CENS[year=1881]%),""???"",""""))",,,32
TAG="1891","=TextIf(Exists(%INDI.CENS[year=1891].AGE%),%INDI.CENS[year=1891].AGE%,TextIf(Exists(%INDI.CENS[year=1891]%),""???"",""""))",,,32
TAG="1901","=TextIf(Exists(%INDI.CENS[year=1901].AGE%),%INDI.CENS[year=1901].AGE%,TextIf(Exists(%INDI.CENS[year=1901]%),""???"",""""))",,,32
TAG="1911","=TextIf(Exists(%INDI.CENS[year=1911].AGE%),%INDI.CENS[year=1911].AGE%,TextIf(Exists(%INDI.CENS[year=1911]%),""???"",""""))",,,32
TAG="Spouse","=TextIf(Exists(%INDI.~SPOU>NAME:FULL%),%INDI.~SPOU>NAME:FULL% . "" ("" . RecordId(%INDI.~SPOU>%) . "")"","""")",,,119
FILTER=GEN,EXC,IF,N,"","INDI.BIRT.DATE:YEAR",,">",NUMBER,1911
FILTER=GEN,EXC,IF,N,"","INDI.DEAT.DATE:YEAR",,"<",NUMBER,1841
FILTER=GEN,EXC,IF,N,"","INDI.CENS",,"null"
I think I need to do some work on this one to make clicking the age take you to the event.

Re: Expression for file roots wife

Posted: 04 Feb 2020 23:11
by Jane
Just so you know, you can attached .fhq files rather than pasting in the code.

Re: Expression for file roots wife

Posted: 04 Feb 2020 23:20
by jelv
I'm used to SMS forums, not phpbb and couldn't see the attach option for looking! :oops: I've found it now!