* Autotext syntax problem.

AS allows faster and more convenient creation of source records for Family Historian.
Post Reply
avatar
ColinMc
Superstar
Posts: 458
Joined: 17 Jan 2019 11:35
Family Historian: V7
Location: Edinburgh

Autotext syntax problem.

Post by ColinMc »

Can someone please tell me what I've done wrong here.

Looking at an Autotext entry in AS 7.2.7

Code: Select all

=IF[{KEYFATHER}%=LINKIND[{KEYFATHER.ID}%{KEYFATHER.FULL}] {KEYFATHER.DECEASED}
=IF[{KEYFATHER.OCCUPATION}%{KEYFATHER.OCCUPATION}%\<No Occupation\>]%]

=IF[{KEYFATHER}%=LINKIND[{KEYMOTHER.ID}%{KEYMOTHER.GN} {KEYFATHER.SN}] {KEYMOTHER.DECEASED}
M.S. {KEYMOTHER.SN}%=LINKIND[{KEYMOTHER.ID}%{KEYMOTHER.FULL}]]

I'm trying to ensure that if a father is not listed on a B Cert, the mothers name is recorded properly.

This works perfectly when both parents details are given.
AS1.jpg
AS1.jpg (11.44 KiB) Viewed 2468 times

But when I delete the father, the expression is still being evaluated as if a father is present albeit it does not have a surname to output.
AS2.jpg
AS2.jpg (10.47 KiB) Viewed 2468 times
The final part of the sentence for the mother is not even looked at.
Colin McDonald - Researching McDonald, McGillivray, Tait, Rountree families
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Autotext syntax problem.

Post by tatewise »

It looks like {KEYFATHER} is true all the time, but has <No Name> when deleted.
I wonder if the tick next to the Father: entry should be cleared to inhibit it in AutoText?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
ColinMc
Superstar
Posts: 458
Joined: 17 Jan 2019 11:35
Family Historian: V7
Location: Edinburgh

Re: Autotext syntax problem.

Post by ColinMc »

Thanks for that. I had stared at the syntax for hours thinking I had something wrong. I knew {KEYFATHER} was still active as the MS was displaying, but did not think of unticking the Tickbox for Father.

Doing so does solve the wording for mother, but has the additional effect of removing both the No Data entries for the father (which I can live with quite happily). I can add them manually afterwards if I'm bothered.

It does appear that there is a difference between father being unticked, and father apparently existing but with no data.

Thanks for the help, problem solved.
Colin McDonald - Researching McDonald, McGillivray, Tait, Rountree families
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Autotext syntax problem.

Post by tatewise »

You can probably test =EQUAL[{KEYFATHER}%\<No Name\>] if you needed to.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
NickWalker
Megastar
Posts: 2597
Joined: 02 Jan 2004 17:39
Family Historian: V7
Location: Lancashire, UK
Contact:

Re: Autotext syntax problem.

Post by NickWalker »

Hi Colin

As the Help says:
The tickbox for Father and Mother should be unticked as relevant if one or other are not mentioned in the birth source document. For example, it is quite common for early baptisms to only record the father's name and by unticking the mother, the auto-text feature (used to generate a transcription of the source text) will not include the mother's details. Note that unticking a parent still implies that they are a parent of this individual, they are just not mentioned specifically in the entry.
In Autotext if you want to check for the existence of someone (e.g. Father) then use the ID in your IF function as this returns nothing if the individual doesn't exist, thus avoiding the '<No Name>' issue. Also by 'nesting' the IF functions and also including the carriage returns within the IF, you can avoid having blank lines appear (if that's what you want):

Code: Select all

=IF[{KEYFATHER.ID}%=LINKIND[{KEYFATHER.ID}%{KEYFATHER.FULL}] {KEYFATHER.DECEASED}
=IF[{KEYFATHER.OCCUPATION}%{KEYFATHER.OCCUPATION}%\<No Occupation\>]

%]=IF[{KEYFATHER}%=LINKIND[{KEYMOTHER.ID}%{KEYMOTHER.GN} {KEYFATHER.SN}] {KEYMOTHER.DECEASED}
M.S. {KEYMOTHER.SN}%=LINKIND[{KEYMOTHER.ID}%{KEYMOTHER.FULL}]]

Cheers

Nick
Nick Walker
Ancestral Sources Developer

https://fhug.org.uk/kb/kb-article/ancestral-sources/
avatar
ColinMc
Superstar
Posts: 458
Joined: 17 Jan 2019 11:35
Family Historian: V7
Location: Edinburgh

Re: Autotext syntax problem.

Post by ColinMc »

Thanks both of you. I'm just going out but will look at this tonight.
Colin McDonald - Researching McDonald, McGillivray, Tait, Rountree families
avatar
ColinMc
Superstar
Posts: 458
Joined: 17 Jan 2019 11:35
Family Historian: V7
Location: Edinburgh

Re: Autotext syntax problem.

Post by ColinMc »

Thanks for the clarification on "unticking" parents. I had not spotted that.
tatewise wrote: 15 Apr 2021 08:48 You can probably test =EQUAL[{KEYFATHER}%\<No Name\>] if you needed to.
Also think I don't need this at the moment, the first solution now confirmed by Nick, works for me.

I read the new code Nick suggested with interest, and had a think about it. On balance, in this case, I quite liked having <No Name> displayed, as it clearly shows that there was no data, so I'll stay with my wording, but improve the nesting as you suggest

I do find it difficult to create/understand complex Nested statements, and in general I'll tend to keep it simple, and remove any surplus line breaks manually (if I remember).
Colin McDonald - Researching McDonald, McGillivray, Tait, Rountree families
Post Reply