* Using selected Text from Source in sentence templates

Questions regarding use of any Version of Family Historian. Please ensure you have set your Version of Family Historian in your Profile. If your question fits in one of these subject-specific sub-forums, please ask it there.
Post Reply
User avatar
MichaelM
Platinum
Posts: 31
Joined: 14 Jul 2021 14:01
Family Historian: V7
Location: UK

Using selected Text from Source in sentence templates

Post by MichaelM »

I've had an initial go at setting up AS to enter census data, and it's pretty impressive. This is what I have for my first source, derived from a custom source template:
29.07.2021_21.07.35_REC.png
29.07.2021_21.07.35_REC.png (31.39 KiB) Viewed 2508 times
I'd like if possible to use some of that information in a fact sentence that I can use in narrative reports. Currently I have
<para>{date:YEAR} census: On {date:DAY} {date:MONTH_NAME} {individual} appeared in the census <at {address},> {_place}, {age}. <{note}>
which gives this for William Daniel Strange:
1851 census: On 30 March he appeared in the census at Downend, Mangotsfield, Gloucestershire, aged 2.

Is there a way to extract the labelled Text from Source, such as 'Unm' and 'Son' to get something like this:
1851 census: On 30 March he appeared as "Unm Son" in the census at Downend, Mangotsfield, Gloucestershire, aged 2.
Michael
avatar
jbtapscott
Megastar
Posts: 513
Joined: 19 Nov 2014 17:52
Family Historian: V7
Location: Corfu, Greece
Contact:

Re: Using selected Text from Source in sentence templates

Post by jbtapscott »

I'm not aware of any way to extract the text directly from the Text in Source, but I have modified the AS templates such that my sentences now show, for example, "..... at Farm House in Henley, Somerset, England. Relationship to Head of Family: Head, Marital Status: Married, Occupation: Farmer 20 Acres."

This was achieved by modifying the Column Type in the template to "Generic", the Recording option to be "Append to census event local note" and the Record even if no data entered unticked. I have only set the Relationship, Marital Status and Occupation in this way.

It's a bit of a faf because I had to change the template for each census year but as least it gives me result I want. (You also should be aware that, when there is an upgrade to AS, these changes could get reset).
Brent Tapscott ~ researching the Tapscott and Wallace family history
Tapscott & Wallace family tree
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Using selected Text from Source in sentence templates

Post by tatewise »

Yes, as Brent says, it is extremely difficult to extract details from a Text From Source table for a particular person.
However, if I get a few moments, I'll investigate what is possible.

The alternative method that some have started to use is to add Fact Witnesses with a Role for each person that in your case would be Unmarried Son or Wife, etc.
See Sentence to print all members of a census household in narrative reports (19638) which does something similar.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
MichaelM
Platinum
Posts: 31
Joined: 14 Jul 2021 14:01
Family Historian: V7
Location: UK

Re: Using selected Text from Source in sentence templates

Post by MichaelM »

Thank you both. I'll try both options and see which I find easiest to work with.
Michael
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Using selected Text from Source in sentence templates

Post by tatewise »

I've experimented with extracting details from the Text From Source field with little success.
I think the only way of selecting the required row of text would involve the =GetLabelledText() function.
However, its help says: "Note: paragraphs within tables (in rich text notes) are not searched or matched by this function."
So it seems impossible to selectively extract rows of text from a table.
Therefore, you have to avoid using tables and just have tab separated text such as shown below, and use an expression like {=GetLabelledText( %FACT.SOUR>TEXT%, "Name 3:" )} to extract the required row, but that still needs further work to extract and translate the Condition and Sex.

Code: Select all

Label	Name		Relat'n	Cond'n	Sex	Age
Name 1: Thomas Strange	Head	Mar	M	35
Name 2: Mary Strange	Wife	Mar	F	32
Name 3: William Strange	Son 	Unm	M	 2
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
MichaelM
Platinum
Posts: 31
Joined: 14 Jul 2021 14:01
Family Historian: V7
Location: UK

Re: Using selected Text from Source in sentence templates

Post by MichaelM »

Since my main wish is to be able to add the information to narrative sentences, I'm thinking perhaps of adding "Role: unmarried son" etc to the census fact Note field on a person by person basis. That does mean that after adding a whole bunch of people quickly with AS I'll have to visit them all one by one to update that field, but that still may be quicker than alternatives.
Michael
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Using selected Text from Source in sentence templates

Post by tatewise »

Yes, that would work and is similar to the technique in the FHUG Knowledge Base Narrative Report Fact Sentence Templates under Custom Fact Fields that offers some further tips.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
jbtapscott
Megastar
Posts: 513
Joined: 19 Nov 2014 17:52
Family Historian: V7
Location: Corfu, Greece
Contact:

Re: Using selected Text from Source in sentence templates

Post by jbtapscott »

As I said in my earlier response, you can achieve this automatically by modifying the templates. Yes, it's a "hit" on your time to start with (by having to change the main templates - took me about 30 minutes to change all the English & Welsh ones) but after that you don't have to remember to go back and change each individual's Census fact note!
Brent Tapscott ~ researching the Tapscott and Wallace family history
Tapscott & Wallace family tree
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Using selected Text from Source in sentence templates

Post by tatewise »

Brent, that is true, but somehow the entries such as Unm and S need to be translated to unmarried son to read sensibly in the narrative sentence. That would probably need a significant number of {=TextIf( )} expressions to cater for all possibilities.
e.g.
{=TextIf( GetLabelledText(%FACT.NOTE2%,"Relationship:") = "S", "Son", ... )}
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
MichaelM
Platinum
Posts: 31
Joined: 14 Jul 2021 14:01
Family Historian: V7
Location: UK

Re: Using selected Text from Source in sentence templates

Post by MichaelM »

Ah yes, thanks Brent, it's gradually becoming clearer the way the various options are linked. I was treating your suggestion as separate, but I see now that it's actually a potentially quicker way of doing (almost) what I'd just said. :oops:

I can understand why users here have talked about experimenting with FH for months before settling on the choices to be made. Starting from a TMG dataset with a fair number of user-configurations isn't proving easy. But I'm getting there slowly, and am really liking FH so far.
Michael
Post Reply