* Sentence for a custom fact

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
avatar
kfunk_ia
Diamond
Posts: 68
Joined: 03 Dec 2019 22:50
Family Historian: V7
Location: Iowa, United States

Sentence for a custom fact

Post by kfunk_ia » 08 Aug 2021 16:19

I am re-creating my sentences for custom facts from RM and have hit a bit of a snag. Currently I have written the following:

{%CUR_PRIN.NAME[1]:FIRST%}'s obituary was published <in the {=TextPart(%FACT.PLAC%, 1)}>< {value}>< {date}>

This gives me a perfectly acceptable sentence which reads something like:
Richard's obituary was published in the Ottumwa Courier on 1 October 1968.

Eventually I would like it to read 'Ottumwa, Iowa Courier' but I suspect that is going to be more work than I want to put in right now since my places are not entered using ,'s to separate the parts. I use the 'city, county, state' method of entry so I am assuming I would have to concatenate TextPart(%FACT.PLAC%, 1) with TextPart(%FACT.PLAC%, 3) or something like that.

More importantly is that some of my obituaries do not have a date or a place, but instead they came from a website, such as findagrave.com or the funeral home's website. Other obits are from unknown newspapers, so they don't have a date and place either. I am assuming that there is going to be some functions involved to make this sentence handle either of the situations. In RM the name of the newspaper, or the name of the website are in the Description field, which fH calls value in the templates.

What I am looking for is basically an OR like can be done in RM templates so that I get either <in the {=TextPart(%FACT.PLAC%, 1)}>< {value}>< {date}> OR <on >{value} so that the sentence will either read "in the Ottumwa Courier on 1 October 1968" OR "on Lange Brothers Funeral Home website" based on whether the is a %FACT.PLAC%. Suggestions would be helpful.

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Sentence for a custom fact

Post by tatewise » 08 Aug 2021 17:34

Why not set the description value as below and avoid the Place name altogether:
in the Ottumwa, Iowa Courier
OR
on Lange Brothers Funeral Home website
OR
whatever wording works including being left empty.

Then the Sentence Template would be:
{%CUR_PRIN.NAME[1]:FIRST%}'s obituary was published< {value}>< {date}>
You could also add < {place}> if you wanted.
That will handle missing {value} or missing {date} or missing {place}.

The Facts tab lower pane would look like:
Obituary: in the Ottumwa, Iowa Courier
OR
Obituary: on Lange Brothers Funeral Home website
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
kfunk_ia
Diamond
Posts: 68
Joined: 03 Dec 2019 22:50
Family Historian: V7
Location: Iowa, United States

Re: Sentence for a custom fact

Post by kfunk_ia » 08 Aug 2021 19:23

>"Why not set the description value as below and avoid the Place name altogether:
>in the Ottumwa, Iowa Courier
>OR
>on Lange Brothers Funeral Home website
>OR
>whatever wording works including being left empty."

Because I would really like to avoiding going back and changing over just under 5,000 individual obituary facts. Plus I need to be able to dump the data back to Rootsmagic in order to dump it to Ancestry and GEDCOM it out for a private site that I have using TNG. Plus it make for some awkward sentences in a narrative report, without a bunch of editing.

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Sentence for a custom fact

Post by tatewise » 08 Aug 2021 21:58

Sorry, I did not realise you have so many established legacy facts.

In the case of "Richard's obituary was published in the Ottumwa Courier on 1 October 1968." am I correct in assuming that Ottumwa is the first Place part and Courier is the fact value?

If so, the solution needs the use of multiple CombineText() functions that are similar to the < > chevron but more powerful.

{%CUR_PRIN.NAME[1]:FIRST%}'s obituary was published{=CombineText( " in the ", TextPart( %FACT.PLAC%, 1), CombineText( " ", %FACT% ), CombineText( " on ", %FACT% ) )}< {date}>

The outermost function is {=CombineText( " in the ", TextPart( %FACT.PLAC%, 1), [suffix value part], [else value part] )}

So if TextPart( %FACT.PLAC%, 1) exists it is prefixed by " in the " and suffixed by [suffix value part] which is another CombineText() function CombineText( " ", %FACT% ) to insert a space on the fact Value if that exists.

If TextPart( %FACT.PLAC%, 1) does not exist then it uses the [else value part] which is yet another CombineText() function CombineText( " on ", %FACT% ) to prefix " on " before the fact Value if it exists.

The template works for any combination Place name, fact Value, and Date.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
kfunk_ia
Diamond
Posts: 68
Joined: 03 Dec 2019 22:50
Family Historian: V7
Location: Iowa, United States

Re: Sentence for a custom fact

Post by kfunk_ia » 11 Aug 2021 00:44

Ok, I pasted that in, and it did exactly what I wanted, in both cases where there is a place and paper name, and in places where there is just a website. Thank you, very much!

Your assumptions about Ottumwa and Courier are correct.

I am using {value} to represent something that would normally have been in the Rootsmagic description field. I am doing this because in RM7 if you are using their find option to find something based on a field, you would essential look for the Obit fact, specifically the {value}.

What I guess is stumping me now is where is the {value} coming from. For example, if I were running a query, I drilled down under my Obit attribute and I have no idea where the {value} is. So if I wanted to use that {value} in an expression, or a query to find anyone that may have had findagrave.com in the (RM description) or value in FH?

In the template that you wrote, you simply use %FACT%, which I assume is a lot like 'this' in certain programming languages (such as Java).

And for what it is worth, I installed the Change Any Fact Type plugin to change my Obit facts to Obit Attributes and the change log that was generated showed me where my problems were in RM, so I am editing there before bringing the file over when I am done learning. Thank you again!

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Sentence for a custom fact

Post by tatewise » 11 Aug 2021 09:16

The way to specify an Attribute value in Expressions depends on the context.

Sentence Templates allow either {value} or %FACT% but {value} is not allowed inside functions such as =CombineText().
The codes such as {vaue}, {date} & {place} are only allowed in Sentence Templates.
The data ref equivalents are %FACT%, %FACT.DATE% & %FACT.PLAC% but without any prefix.

Fact Queries only allow %FACT% for the Attribute value, because the context is similarly Facts.

Elsewhere, the data ref would be more like %INDI._ATTR-OBITUARY% for the Attribute value.

To be more explicit there is the =FactValue() function where the parameter would be a Fact data ref as above.

BTW: Earlier you said:
Eventually I would like it to read 'Ottumwa, Iowa Courier' but I suspect that is going to be more work than I want to put in right now since my places are not entered using ,'s to separate the parts. I use the 'city, county, state' method of entry so I am assuming I would have to concatenate TextPart(%FACT.PLAC%, 1) with TextPart(%FACT.PLAC%, 3) or something like that.
Are you still interested in achieving that style of narrative sentences?
However, it seems contradictory. The first sentence says you don't use comma (,) separators, but the second sentence implies that you do use comma separators. Can you please clarify.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
kfunk_ia
Diamond
Posts: 68
Joined: 03 Dec 2019 22:50
Family Historian: V7
Location: Iowa, United States

Re: Sentence for a custom fact

Post by kfunk_ia » 11 Aug 2021 10:48

My apologies, I made a typo. My places are entered as comma separated parts, and I only use the 'city, county, state' format. I don't use country name in United States entries. If I only know the county and state, then it is entered as 'county, state', or if I only know the state, then that is what is entered.

What I don't do is enter anything like ,county, state, or ,,state which I see a lot of people do. I am not overly concerned with getting 'Ottumwa, IA Courier' at this time. I kind of like the looks of the sentence as is. I do appreciate you help to this point.

User avatar
ColeValleyGirl
Megastar
Posts: 4854
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: Sentence for a custom fact

Post by ColeValleyGirl » 11 Aug 2021 11:08

A word of caution about places: if you're ever going to want to map your places (via geocoding them) you will need to include the country, otherwise you will get come very strange results. See Working with Places and Addresses and Geocoding and the Map Window if this is something you think you might want to do.

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Sentence for a custom fact

Post by Jane » 11 Aug 2021 11:37

Don't forget you can also use negative numbers on Text Part so if you want the last element if the data you can use -1
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

avatar
kfunk_ia
Diamond
Posts: 68
Joined: 03 Dec 2019 22:50
Family Historian: V7
Location: Iowa, United States

Re: Sentence for a custom fact

Post by kfunk_ia » 11 Aug 2021 23:08

ColeValleyGirl wrote:
11 Aug 2021 11:08
A word of caution about places: if you're ever going to want to map your places (via geocoding them) you will need to include the country, otherwise you will get come very strange results. See Working with Places and Addresses and Geocoding and the Map Window if this is something you think you might want to do.
I will keep that in mind. I have been geocoding in RM and so far it has worked well, but since I don't usually map and I am more concerned with decent looking reports than with mapping, I suspect it won't be much of an issue when I move.

Post Reply