* Multiple Field Codes and Separators
Multiple Field Codes and Separators
I have been using FH for just over a year after importing from TMG. I have spent most of this time adding more data and reorganising the information I already had. I am now starting to work on reports and sentence construction where I am running into a few problems. I have had a search on this and had a look at the Calico help topics but I am still having a problem with angle brackets and multiple codes.
I have a 'CensusUK' fact imported from TMG and I wish to add the occupation of a witness into their fact sentence in their various roles e.g. wife. Following the example in the help file I have added the following to the witness note:
Occupation:a Dressmaker
Using the sentence:
{%CUR~WITN>NAME:FIRST%}'s occupation was given as {=GetLabelledText(%CUR~WITN.NOTE2%, "Occupation:")}
crrectly generates a sentence of:
Eleanor's occupation was given as a Dressmaker.
However, if the individual does not have an occupation then, obviously, the sentence should not appear thus I enclosed it in angle brackets i.e:
<{%CUR~WITN>NAME:FIRST%}'s occupation was given as {=GetLabelledText(%CUR~WITN.NOTE2%, "Occupation:")}>
In the case of Eleanor this now results in a sentence:
Eleanor's occupation was given as {=GetLabelledText(%CUR~WITN.NOTE2%, "Occupation:")}
If I change the sentence to:
<Their occupation was given as {=GetLabelledText(%CUR~WITN.NOTE2%, "Occupation:")}>
results in:
Their occupation was given as a Dressmaker.
However, it is not very elegant.
This is quite a long post for what I am sure is a simple solution to the problem but it is one that evades me. This is just one example of problems I am having with multiple codes within angled brackets and I would appreciate any help.
thanks,
Mac.
I have a 'CensusUK' fact imported from TMG and I wish to add the occupation of a witness into their fact sentence in their various roles e.g. wife. Following the example in the help file I have added the following to the witness note:
Occupation:a Dressmaker
Using the sentence:
{%CUR~WITN>NAME:FIRST%}'s occupation was given as {=GetLabelledText(%CUR~WITN.NOTE2%, "Occupation:")}
crrectly generates a sentence of:
Eleanor's occupation was given as a Dressmaker.
However, if the individual does not have an occupation then, obviously, the sentence should not appear thus I enclosed it in angle brackets i.e:
<{%CUR~WITN>NAME:FIRST%}'s occupation was given as {=GetLabelledText(%CUR~WITN.NOTE2%, "Occupation:")}>
In the case of Eleanor this now results in a sentence:
Eleanor's occupation was given as {=GetLabelledText(%CUR~WITN.NOTE2%, "Occupation:")}
If I change the sentence to:
<Their occupation was given as {=GetLabelledText(%CUR~WITN.NOTE2%, "Occupation:")}>
results in:
Their occupation was given as a Dressmaker.
However, it is not very elegant.
This is quite a long post for what I am sure is a simple solution to the problem but it is one that evades me. This is just one example of problems I am having with multiple codes within angled brackets and I would appreciate any help.
thanks,
Mac.
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Multiple Field Codes and Separators
Welcome to the FHUG Mac.
The problem you describe is a common trap that new users fall into.
Inside < angle brackets > only one {code} can be used to determine whether its contents should be displayed.
The common example is <at {address}>
But your sentence has two {codes} inside the < angle brackets >,
i.e. {%CUR~WITN>NAME:FIRST%} and {=GetLabelledText(...)}
So FH gets confused, only checks the first {code} and treats the rest as plain text.
The solution is to use the =CombineText(...) function which nominates a specific parameter as the one to govern the display.
e.g.
{=CombineText( Text(%CUR~WITN>NAME:FIRST% . "'s occupation was given as"), GetLabelledText(%CUR~WITN.NOTE2%,"Occupation:"), "" )}
The 2nd parameter GetLabelledText(...) governs whether a display is produced.
The 1st parameter is the textual prefix and must be constructed within a Text(...) function.
The 3rd parameter is the empty suffix "".
BTW: As a separate discussion we strongly recommend that you convert your CensusUK custom facts to the standard Census events as per FHUG Knowledge Base articles Recording from a Census Record and Importing to Family Historian under Import from The Master Genealogist (TMG) in the Correcting Problems section for Census (CENS) facts.
The problem you describe is a common trap that new users fall into.
Inside < angle brackets > only one {code} can be used to determine whether its contents should be displayed.
The common example is <at {address}>
But your sentence has two {codes} inside the < angle brackets >,
i.e. {%CUR~WITN>NAME:FIRST%} and {=GetLabelledText(...)}
So FH gets confused, only checks the first {code} and treats the rest as plain text.
The solution is to use the =CombineText(...) function which nominates a specific parameter as the one to govern the display.
e.g.
{=CombineText( Text(%CUR~WITN>NAME:FIRST% . "'s occupation was given as"), GetLabelledText(%CUR~WITN.NOTE2%,"Occupation:"), "" )}
The 2nd parameter GetLabelledText(...) governs whether a display is produced.
The 1st parameter is the textual prefix and must be constructed within a Text(...) function.
The 3rd parameter is the empty suffix "".
BTW: As a separate discussion we strongly recommend that you convert your CensusUK custom facts to the standard Census events as per FHUG Knowledge Base articles Recording from a Census Record and Importing to Family Historian under Import from The Master Genealogist (TMG) in the Correcting Problems section for Census (CENS) facts.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Multiple Field Codes and Separators
Thanks for your prompt response Mike. I thought it may involve other functions but wasn't sure which one to use. I had a look at 'Multiple Field Codes and Separators' topic in the help file which seems to say that you can have multiple codes within angle brackets. I shall keep educating myself.
I'll also have a look at converting the census records to the standard fact type as I still have hundreds of census records to add. I aim to use Ancestral Sources for this so it would keep things consistent.
Regards,
Mac.
I'll also have a look at converting the census records to the standard fact type as I still have hundreds of census records to add. I aim to use Ancestral Sources for this so it would keep things consistent.
Regards,
Mac.
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Multiple Field Codes and Separators
That topic in the Help applies to Source Template Formats and not Sentence Template Codes.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Multiple Field Codes and Separators
Thanks Mike. As I say, more education required. I ended up with the expression
{=TextIf(ContainsText(%CUR~WITN.NOTE2%,"Occupation:",),CombineText(". "Text(%CUR~WITN>NAME:FIRST% . "'s occupation was given as "), GetLabelledText(%CUR~WITN.NOTE2%,"Occupation:"), "" ),"")}
to take account of those records without an occupation.
{=TextIf(ContainsText(%CUR~WITN.NOTE2%,"Occupation:",),CombineText(". "Text(%CUR~WITN>NAME:FIRST% . "'s occupation was given as "), GetLabelledText(%CUR~WITN.NOTE2%,"Occupation:"), "" ),"")}
to take account of those records without an occupation.
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Multiple Field Codes and Separators
I don't understand why you think you need the surrounding =TextIf(...) function.
If the Occupation: label is missing then GetLabelledText(%CUR~WITN.NOTE2%,"Occupation:") returns nothing which inhibits the entire CombineText(...) function completely so nothing is displayed.
So this should be sufficient:
{=CombineText( Text(%CUR~WITN>NAME:FIRST% . "'s occupation was given as"), GetLabelledText(%CUR~WITN.NOTE2%,"Occupation:"), "" )}
If the Occupation: label is missing then GetLabelledText(%CUR~WITN.NOTE2%,"Occupation:") returns nothing which inhibits the entire CombineText(...) function completely so nothing is displayed.
So this should be sufficient:
{=CombineText( Text(%CUR~WITN>NAME:FIRST% . "'s occupation was given as"), GetLabelledText(%CUR~WITN.NOTE2%,"Occupation:"), "" )}
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Multiple Field Codes and Separators
Strange. When I first used the expression on someone without an occupation it returned
Eleanor's occupation was given as.
Hence why I used the TextIf function. However, as you say, your simpler expression now works. I must have made an error somewhere. Thanks again.
Eleanor's occupation was given as.
Hence why I used the TextIf function. However, as you say, your simpler expression now works. I must have made an error somewhere. Thanks again.