* Adding relationship to Root to narrative reports

Questions regarding use of any Version of Family Historian. Please ensure you have set your Version of Family Historian in your Profile
Post Reply
avatar
gosforthian
Gold
Posts: 11
Joined: 10 Dec 2020 10:21
Family Historian: V7

Adding relationship to Root to narrative reports

Post by gosforthian » 12 Jan 2021 16:54

Hi. Is it possible to add the relationship-to-root attribute to each person so that it appears in narrative reports, and on diagrams? So that for each person in the report it would say what their relationship to the root person was? The text in a report would be something like "Joseph Smith is the <first cousin once removed> of Mr Root".

Thanks

User avatar
tatewise
Megastar
Posts: 20060
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Adding relationship to Root to narrative reports

Post by tatewise » 12 Jan 2021 17:06

You already asked that in How related in list form (17830) so I'll repeat my answer here.

Welcome to the FHUG.

The answer is probably yes, but the details need to be clarified.

Where in Narrative reports would you want that to appear?
e.g. After the 'was born' sentence?

Do you want it even for very close relatives like father, mother, son, daughter, etc?

In a Diagram it is easier as it only needs the Text Scheme to be edited with the standard Relationship to File Root item.
In the Diagram > Options > Text tab, select your preferred Text Scheme and click Clone... to create a custom copy.
Then use Edit Text Scheme... and add the Relationship to File Root from Available Items.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
gosforthian
Gold
Posts: 11
Joined: 10 Dec 2020 10:21
Family Historian: V7

Re: Adding relationship to Root to narrative reports

Post by gosforthian » 13 Jan 2021 12:19

Mike. Thanks very much. Sorry for the repetition, I wasn't sure it would be spotted buried in another item. Ian

avatar
gosforthian
Gold
Posts: 11
Joined: 10 Dec 2020 10:21
Family Historian: V7

Re: Adding relationship to Root to narrative reports

Post by gosforthian » 13 Jan 2021 12:26

Hi Mike. And now a reply to your question. I think it would inded be best after the 'was born' sentence. Good question about close relatives, and it would be a little redundant in those cases, but I could live with it. I can see how it could be done in diagrams and will try it out. I would be really interested in how it could be added to reports please. Thanks again. Ian

User avatar
tatewise
Megastar
Posts: 20060
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Adding relationship to Root to narrative reports

Post by tatewise » 13 Jan 2021 14:08

To alter Narrative reports the Sentence Template of one or more Facts must be edited.
The FHUG Knowledge Base article Narrative Report Fact Sentence Templates describes the framework.

So to change the birth sentence use Tools > Fact Types..., select the Birth fact and click Edit...
The Sentence Template will probably be something like:
{individual} was born {date} {place} <({age})>. <The informant on the birth certificate was {role=informant}.>
That will produce a sentence such as John SMITH was born on 1 March 1900 in London.
If there is Fact Witness as Informant then it will add The informant on the birth certificate was Jane DOE.
You can see those sentences in the Sentence box of the Birth fact in any Facts tab.

You need to add quite a complex sentence expression either between or after the two existing sentence expressions.
This sentence is conditional so it will use a {=TextIf( condition , text if true , text if false )} function.
The functions are defined in Help > Family Historian Help > General Topics > Advanced Topics > Understanding Functions.

The condition needs to check the number of generations between the File Root and the current principal person to exclude the sentence for close relatives.
RelationCode( FileRoot(), %CUR_PRIN%, GENERATION, 1 ) supplies the number of +ve or -ve generations.
Diff( 0, RelationCode( FileRoot(), %CUR_PRIN%, GENERATION, 1 ) ) < 2 is true if the modulus is less than 2.

The text if true will be nothing for close relatives.

The text if false will need to say such as He is the grandfather of John SMITH.
Sex( %CUR_PRIN%, "He is the ", "She is the ", "They are the " ) generates the first part depending on person's sex.
Relationship( FileRoot(), %CUR_PRIN%, TEXT, 1 ) generates the relationship to the File Root.
FileRoot() generates the name of the File Root person.
The Text( . . . ) function joins fragments of text together to hide all the commas and form one text if false.

So the whole text if false sentence expression is:
Text( Sex(%CUR_PRIN%,"He is the ","She is the ","They are the ") . Relationship(FileRoot(),%CUR_PRIN%,TEXT,1) . " of " . FileRoot() . ". ")

Then the entire conditional sentence expression is:
{=TextIf( Diff(0,RelationCode(FileRoot(),%CUR_PRIN%,GENERATION,1)) < 2, , Text( Sex(%CUR_PRIN%,"He is the ","She is the ","They are the ") . Relationship(FileRoot(),%CUR_PRIN%,TEXT,1) . " of " . FileRoot() . ". " ) )}

It is imperative that every piece of punctuation and every word is correct, otherwise it will fail.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
gosforthian
Gold
Posts: 11
Joined: 10 Dec 2020 10:21
Family Historian: V7

Re: Adding relationship to Root to narrative reports

Post by gosforthian » 13 Jan 2021 14:38

Hi Mike. wow!. Luckily I used to be a computerr programmer, but even so with my fat fingers it will take a while to get right. Thanks very much. Ian

User avatar
tatewise
Megastar
Posts: 20060
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Adding relationship to Root to narrative reports

Post by tatewise » 13 Jan 2021 14:43

Use Copy & Paste :!:
But also study the components and review how it all fits together.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
gosforthian
Gold
Posts: 11
Joined: 10 Dec 2020 10:21
Family Historian: V7

Re: Adding relationship to Root to narrative reports

Post by gosforthian » 13 Jan 2021 14:56

Mike.
An implementation question. I have 3 FH projects. Will this amendment apply to all projects, or just the project I amended it in?

And a supplementary, is there something in the GEDCOM definition that forbids this relationship to root from being an attribute or fact that we could simply add from a report options dropdown list?

Thanks again
Ian

User avatar
tatewise
Megastar
Posts: 20060
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Adding relationship to Root to narrative reports

Post by tatewise » 13 Jan 2021 15:20

New to FH V7 you now have a choice.
If you simply edit the Standard Fact Set Birth event definition, then it applies to all Projects.
But you now have the option of creating Project only Facts Sets.
If you Copy... the Birth event definition to a Project only Fact Set and edit that, it only affects the one Project.

In principle, there is nothing in the GEDCOM specification that precludes such a Fact.
But all the concepts of File Root and Relationships and Narrative Sentences and Reports are proprietary FH features.
They are completely outside the scope of GEDCOM which is a GEnealogy Data COMmunication standard.

Expressions comprising Data References & Functions are only allowed in certain features in FH, which don't include Facts.
So the best you could do would be to add a Fact and manually enter the relationship of the person to the File Root.
However, the File Root is dynamic, so that relationship would be wrong as soon as the File Root was changed.
But if you were happy for the relationship to be relative to a fixed person then you could experiment with that idea.
What you enter could be the whole literal sentence in the Sentence box at the bottom with no functions.
However, remember you would have to add that Fact to every new Individual record with a Date just after Birth.
Whereas, the Sentence Template only needs editing once.

I'm not sure what you mean by a Report options dropdown list.
Different Reports use different formats, so Narrative Reports would still need some form of Sentence Template.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
gosforthian
Gold
Posts: 11
Joined: 10 Dec 2020 10:21
Family Historian: V7

Re: Adding relationship to Root to narrative reports

Post by gosforthian » 13 Jan 2021 16:35

Thanks Mike. Good news about the project specific approach, I will do that. On what I said about the Reports dropdown, I meant it would be nice to have this as an Option, say on the narrative report's Options Main Tab where you can for instance tick the box to add Notes, you could click a box to add the relationship to root. But I guess it would need to be wanted by enough folks for that to be worth adding to FH. Anyway, thanks again for all your help. Regards. Ian

User avatar
tatewise
Megastar
Posts: 20060
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Adding relationship to Root to narrative reports

Post by tatewise » 13 Jan 2021 16:50

But that is my point. Ticking to add Notes is well defined.
But what exactly gets added if you tick Add Relationship?
Where does the sentence go and how is it phrased?
Relationship to who? There are many other options than just File Root.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
gosforthian
Gold
Posts: 11
Joined: 10 Dec 2020 10:21
Family Historian: V7

Re: Adding relationship to Root to narrative reports

Post by gosforthian » 13 Jan 2021 17:15

Hi Mike. It works fine and was easy to add. Thanks. A bit of feedback in case it helps others.

In the Descendants by Generation report the generation test also cuts out a lot of first (and no doubt other) cousins from having their relationship described. So I just used the text function without the testif. The only slight drawback of the approach is that the reference superscript numbers for the source footnotes for the birth event appear at the end of the whole birth "sentence", rather than just after the "was born" phrase. This would also be true if the informant section appeared of course.

And with the new sentence applied to everyone, the root has his own rather odd looking sentence "He is the root of John DOE"

Kind regards
Ian

avatar
gosforthian
Gold
Posts: 11
Joined: 10 Dec 2020 10:21
Family Historian: V7

Re: Adding relationship to Root to narrative reports

Post by gosforthian » 13 Jan 2021 17:17

And I just saw your other reply, you of course make good points .

Regards

Ian

User avatar
tatewise
Megastar
Posts: 20060
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Adding relationship to Root to narrative reports

Post by tatewise » 13 Jan 2021 17:33

To remove the root case and keep the others, put the condition back in but test for equal to 0.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
gosforthian
Gold
Posts: 11
Joined: 10 Dec 2020 10:21
Family Historian: V7

Re: Adding relationship to Root to narrative reports

Post by gosforthian » 13 Jan 2021 17:50

Thanks. Will do.

avatar
gosforthian
Gold
Posts: 11
Joined: 10 Dec 2020 10:21
Family Historian: V7

Re: Adding relationship to Root to narrative reports

Post by gosforthian » 13 Jan 2021 17:52

Probably me being dumb, but won't that omit the sentence for first cousins, and others who would be the same generation?

User avatar
tatewise
Megastar
Posts: 20060
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Adding relationship to Root to narrative reports

Post by tatewise » 13 Jan 2021 18:25

Yes, that's true. :oops:
So use Relationship(FileRoot(),%INDI%,TEXT,1) = "root" instead.

There may also be combinations of the RelationCode( ... ) function with different parameters that could differentiate cousins from siblings, etc.

Try this:
Diff(0,RelationCode( FileRoot(),%CUR_PRIN%,GENERATION,1)) < 2 and Not(RightText(Relationship(FileRoot(),%INDI%,TEXT,1),6) = "cousin")

But also you must cater for missing relationships so try this:
Diff(0,RelationCode( FileRoot(),%CUR_PRIN%,GENERATION,1)) < 2 and Not(RightText(Relationship(FileRoot(),%INDI%,TEXT,1),6) = "cousin") or TextLen(Relationship(FileRoot(),%INDI%,TEXT,1)) = 0
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply