Page 1 of 1

Printing relationship in reports

Posted: 05 Sep 2018 10:45
by blazegate
Would it be possible to add an option to print the relationship to the root when generating reports?

Re: Printing relationnship in reports

Posted: 05 Sep 2018 11:21
by Jane
Which report do you want to include the information on. For some reports it's easy and on other's it's a bit more involved.

Re: Printing relationnship in reports

Posted: 05 Sep 2018 11:22
by tatewise
Probably yes, but which types of Report, and for which Individuals?
e.g.
For Publish > Individual Summary Report the heading line at top of report can include relationship.
Use Report > Options > Format tab then under Heading select Record and click Edit.
In the Heading Text after (=LifeDates2()) insert =Relationship(FileRoot()) at the end.
Click OK twice.
The header will then be as below, but the Father: and Mother: entries underneath have no relationship, but they could.
Example Individual Summary Report with Relationship in Header
Example Individual Summary Report with Relationship in Header
ISRrelationship.png (57.71 KiB) Viewed 9767 times
The more specific detail you can put in your question, the more useful will be our answer.

Re: Printing relationnship in reports

Posted: 05 Sep 2018 18:56
by BobWard
Here is another optional layout to show the relationship to the root person using the ISR format.

Re: Printing relationnship in reports

Posted: 06 Sep 2018 19:44
by blazegate
Bob,
Many thanks for your quick reply.
I am really looking to get the relationship printed in a narrative report. For example, with myself as the root, I would like to be able to print a narrative report of my ancestors printing all their relationships to me.

Kind regards,
Brian Bucklar

Re: Printing relationnship in reports

Posted: 06 Sep 2018 21:25
by BobWard
Brian,

I only use the ISR format for my reports, so I can't offer any tips on getting your relationship request to appear in the Narrative report format. However, I am sure that Mike, or others, will be along shortly to help you with that.
Bob

Re: Printing relationnship in reports

Posted: 06 Sep 2018 21:46
by tatewise
As Jane said, "For some reports it's easy and for other's it's a bit more involved."

Narrative Reports are quite a bit more involved.
They rely entirely on Sentence text derived from Facts entered against each Individual.
So to get relationships into the Report needs a Relationship fact against each Individual.

Such a fact does not already exist as a standard fact so you need to use Tools > Fact Types to create a new custom fact.
Use the New button to create a fact named say Relationship.
Its Sentence Template could be {individual} was the {=Relationship(FileRoot(),%CUR_PRIN%,TEXT,1)} of {=FileRoot()} so it says something like He was the grandfather of Brian Bucklar.
If you want that to appear in the Report before the birth details, then set Normal Time Frame to Pre-Birth.
To appear immediately after the birth details, then set the Normal Time Frame to Shortly After Birth.

Add that Relationship fact to every Individual wherever you want that sentence to appear in the Report.
You would NOT include it in the File Root Individual as it would say He was the root of Brian Bucklar.

But what if you want to cater for various different File Root settings from time to time?
Then you must literally add the Relationship fact to everyone, and change the Sentence Template to be conditional.
{=TextIf( IsSameItem(FileRoot(),%CUR_PRIN%), "", Text( Sex(%CUR_PRIN%,"He","She","He") . " was the ". Relationship(FileRoot(),%CUR_PRIN%,TEXT,1) . " of " . FileRoot()))}
So this tests if File Root and current person are the same, and if so then output the empty string "", otherwise the original sentence but with {individual} replaced by Sex(%CUR_PRIN%,"He","She","He").

In NON-Narrative Reports you may wish to exclude that Relationship fact, but that is up to you.

Re: Printing relationnship in reports

Posted: 07 Sep 2018 12:09
by tatewise
I have given the Narrative Report case a little more thought.
There are cases that are not handled by my proposed Sentence Template expression.
  1. In addition to excluding the root person's relationship to themself, it also needs to exclude the root person's children whose relationship of son or daughter is already stated in the narrative.
  2. When there is no relationship at all then the whole sentence must be inhibited.
  3. For some relationships such as father's wife or mother's husband the sentence does not read well.
In addition to all that, I have realised that the Birth event Sentence Template can accommodate the relationship phrase without any need for a custom Relationship fact.
So forget about creating a Relationship fact and just Edit the Birth event Sentence Template to the following expression:

{individual} was born< {date}>< {place}>< ({age})>{=CombineText( Text( " and is " . FileRoot() . "'s "), TextIf(IsSameItem(FileRoot(),%CUR_PRIN%) or IsSameItem(FileRoot(),%CUR_PRIN.~FATH>%) or IsSameItem(FileRoot(),%CUR_PRIN.~MOTH>%), "", Relationship(FileRoot(),%CUR_PRIN%,TEXT,1) ) )}

which says something like: He was born on 1 May 1900 in London and is Brian Bucklar's grandfather.
unless the relationship is unspecified and so nothing is produced.

The CombineText(...) function only produces any text if a relationship is specified.
If the File Root is the current person or their father or mother then the relationship is blank "" and unspecified.
If the Relationship(...) function returns nothing then the relationship is also unspecified.

That seems to work well in all Narrative Reports (both Ancestor and Descendant) regardless of who is the File Root and who is the Report Root person, providing each person has a Birth event.

To cater for those without a Birth event, but with a Baptism event, then Edit the Baptism event Sentence Template to use the following expression, which adds the condition to exclude text if a Birth event exists:

{individual} was baptised< {date}>< {place}>< {age}>{=CombineText( Text( " and is " . FileRoot() . "'s "), TextIf(IsSameItem(FileRoot(),%CUR_PRIN%) or IsSameItem(FileRoot(),%CUR_PRIN.~FATH>%) or IsSameItem(FileRoot(),%CUR_PRIN.~MOTH>%) or Exists(%CUR_PRIN.BIRT%), "", Relationship(FileRoot(),%CUR_PRIN%,TEXT,1) ) )}.< The godparents were {role(plural)=godparent}.>< The godparent was {role(single)=godparent}.>< The ceremony was conducted by {role=minister}.>< The ceremony was conducted by {role=priest}.>

Re: Printing relationnship in reports

Posted: 09 Sep 2018 19:19
by blazegate
Many thanks for your comprehensive reply,
I think it will take me a while to get to grips with the contents but I will try my best.
Brian

Re: Printing relationnship in reports

Posted: 13 Sep 2018 19:08
by blazegate
Sorry to be a nuisance but could you please explain how to access the Birth Event Sentence Template so I can edit it.
Kind regards,
Brian Bucklar

Re: Printing relationnship in reports

Posted: 13 Sep 2018 19:50
by LornaCraig
To edit the sentence template for any fact, use Tools > Fact Types then select the fact in the list and click the Edit button to the right. See how_to:narrative_report_fact_sentence_templates|> Narrative Report Fact Sentence Templates for full details.

Re: Printing relationnship in reports

Posted: 16 Sep 2018 17:21
by blazegate
Many thanks to all for your help to date.
Unfortunately, editing the birth statement as suggested results in printing rather than executing the code following <(place)> eg:

Tony Roy Bucklar son of Brian George Bucklar and Sheila Ellen Titmus was born on 27 November 1965 in Chippenham, Wiltshire, England{=CombineText( Text(" and is " .FileRoot()."s"), TextIf(IsSameItem(FileRoot(),%CUR_PRIN%).

I have copied and pasted your revised Birth Sentence Template to avoid any typing errors.

Kind regards,
Brian

Re: Printing relationnship in reports

Posted: 16 Sep 2018 17:35
by tatewise
Unfortunately, you have not copy pasted the full function, which is:

Code: Select all

{=CombineText( Text( " and is " . FileRoot() . "'s "), TextIf(IsSameItem(FileRoot(),%CUR_PRIN%) or IsSameItem(FileRoot(),%CUR_PRIN.~FATH>%) or IsSameItem(FileRoot(),%CUR_PRIN.~MOTH>%), "", Relationship(FileRoot(),%CUR_PRIN%,TEXT,1) ) )}
Your posting shows only the first fragment of that text and is missing several closing ) and } brackets that are essential for correct syntax. They must be in matched pairs, and all the other components must be exactly correct. These software expressions are very fussy, and if not perfect then will simply appear in the resulting sentence.

If you cannot fix it, please post the text from the Sentence Template of your Birth Event definition.

Re: Printing relationnship in reports

Posted: 18 Sep 2018 19:52
by blazegate
My birth sentence is: {individual} was born< {date}>< {place}>< ({age})>{=CombineText( Text( " and is " . FileRoot() . "'s "), TextIf(IsSameItem(FileRoot(),%CUR_PRIN%) which is a copy/paste from your instructions.

I am aware of the need to match the quantity of brackets but note that the above statement after ({age}) has one opening { with no matching } and six ( with only four )

Kind regards,
Brian Bucklar

Re: Printing relationnship in reports

Posted: 18 Sep 2018 20:11
by tatewise
Brian, can you see that your Sentence Template is much much shorter than mine in the CODE box earlier.

Yours stops short at ...%CUR_PRIN%) whereas mine shown earlier continues:
...%CUR_PRIN%) or IsSameItem(FileRoot(),%CUR_PRIN.~FATH>%) or IsSameItem(FileRoot(),%CUR_PRIN.~MOTH>%), "", Relationship(FileRoot(),%CUR_PRIN%,TEXT,1) ) )}

Please click SELECT ALL then Copy the blue highlighted text and Paste it into your Sentence Template to replace the {=CombineText(...%CUR_PRIN%) text.

Re: Printing relationship in reports

Posted: 20 Sep 2018 22:05
by blazegate
Eureka!!
Having copied and pasted the full expression, everything works perfectly.
My sincere apologies for not doing this in the first place, (it would have saved you a lot of agro) .
When I first read your instructions, where you had "or" I thought these were alternatives to replace the "IsSameItem etc " in the first line of the code. At 85, I have probably lost too many brain cells.
I have been using FH since version 2.3 and it continues to impress.

Again, many thanks for the excellent program and for your excellent support.
Brian

Re: Printing relationship in reports

Posted: 21 Sep 2018 08:11
by tatewise
I'm glad the result is to your liking.
Yes, the or are combining three alternative cases for the Principal, the Father, and the Mother, each of which must exclude the relationship as it is already in the core sentence.