* Querying sentences - FactSentence function

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
ogulbran
Gold
Posts: 19
Joined: 26 Dec 2017 22:31
Family Historian: V7
Location: Norway
Contact:

Querying sentences - FactSentence function

Post by ogulbran » 07 Jan 2023 14:53

To get an overview of how my sentence templates are working for all my facts I am trying to make a query showing all facts (of a specific type) with the narrative sentences that will be produced.

I am not sure I do understand what the FactSenctence function is meant to produce. Each fact is listed in my query and I have one column with the expression "=FactSenctence(%FACT%,,PRINCIPAL)". For most rows this produce no result - but for a few of the facts it makes a sentence based on the template sentence (and the result is different for rows of same fact type).

Can anyone explain me?

Best regards,
Øivind

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

Re: Querying sentences - FactSentence function

Post by tatewise » 07 Jan 2023 15:26

Hi Øivind.

I guess you are using a Fact type of Query and to filter down to all facts of a specific type you have a Rows tab filter such as:
Add if =FactLabel(%FACT%) contains ["Fact Label"]

Then a Column with Expression: =FactSentence(%FACT%,,PRINCIPAL) should work for all Individual facts.

Maybe you are using an Individual type of Query. That won't work reliably with that Column expression.

Try the FHUG Knowledge Base > Downloads > Fact Queries > All Facts Filter by Label which allows the Type of Fact to be chosen and already has the =FactSentence(...) as a Column expression.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
ogulbran
Gold
Posts: 19
Joined: 26 Dec 2017 22:31
Family Historian: V7
Location: Norway
Contact:

Re: Querying sentences - FactSentence function

Post by ogulbran » 08 Jan 2023 10:09

Thanks for fast reply. Good resource with queries in the Knowledge base that I was not aware of.

But I had done this correct, so I still get the same result.

Have done some testing, and it seems to depend on my fact set. If I delete all my special fact sets it works well.

But the sentences work correctly based on my fact set f.ex. in the "sentence" windows when I view a fact for an individual.

Any idea of what the problem can be?

Best regards,
Øivind

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

Re: Querying sentences - FactSentence function

Post by tatewise » 08 Jan 2023 13:15

I think I have discovered the problem.
If the Sentence Template starts with <br> or <para> then the leading newline characters upset the Query Column display.

I have tried various ways of testing for or removing those leading newline characters without success.
So the best solution is to have three Columns with these Headings & Expressions for the three cases:
Sentence . . . . . . . . . . =FactSentence(%FACT%,,PRINCIPAL) for the normal cases.
<br> Sentence . . . . . =MidText(FactSentence(%FACT%,,PRINCIPAL),3,0) for the <br> cases.
<para> Sentence . . . =MidText(FactSentence(%FACT%,,PRINCIPAL),5,0) for the <para> cases.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
ogulbran
Gold
Posts: 19
Joined: 26 Dec 2017 22:31
Family Historian: V7
Location: Norway
Contact:

Re: Querying sentences - FactSentence function

Post by ogulbran » 08 Jan 2023 14:56

Exactly - that was the problem - and a good solution!

Thank you very much!

Best regards,
Øivind

Post Reply