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
* Querying sentences - FactSentence function
- tatewise
- Megastar
- Posts: 27079
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Querying sentences - FactSentence function
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.
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
Re: Querying sentences - FactSentence function
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
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
- tatewise
- Megastar
- Posts: 27079
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Querying sentences - FactSentence function
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.
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
Re: Querying sentences - FactSentence function
Exactly - that was the problem - and a good solution!
Thank you very much!
Best regards,
Øivind
Thank you very much!
Best regards,
Øivind