Page 1 of 2
Relationships
Posted: 21 Jul 2023 16:22
by Maccbob
Is there a way of displaying a relationship to root person box in the Indvidual Property Box at the top above the Name box on the main tab
Re: Relationships
Posted: 21 Jul 2023 16:31
by BillH
Go to Tools > Preferences and select Property Box and then Captions and add this to the first box:
[=Relationship(FileRoot(),,TEXT,1)]
Bill
Re: Relationships
Posted: 21 Jul 2023 16:48
by Maccbob
Brilliant thank you Bill
Re: Relationships
Posted: 22 Jul 2023 15:41
by fhtess65
That works a treat!!!
BillH wrote: ↑21 Jul 2023 16:31
Go to Tools > Preferences and select Property Box and then Captions and add this to the first box:
[=Relationship(FileRoot(),,TEXT,1)]
Bill
Re: Relationships
Posted: 22 Jul 2023 16:22
by arthurk
BillH wrote: ↑21 Jul 2023 16:31
Go to Tools > Preferences and select Property Box and then Captions and add this to the first box:
[=Relationship(FileRoot(),,TEXT,1)]
Thanks - but please could you (or someone else) explain what the different parts are actually doing? In the program Help, under Functions > FileRoot, there's a simpler term:
=Relationship(FileRoot())
This seems to produce the same result - or are there cases that I haven't found where it doesn't?
Another query:
Without getting very complicated, is it possible to capitalise the relationship (eg
Father rather than
father), in the same way as in the name box at the top of the Focus Window?
Re: Relationships
Posted: 22 Jul 2023 17:02
by BillH
The different parts are defined in the Help under the Relationship function.
https://www.family-historian.co.uk/help ... nship.html
Re: Relationships
Posted: 22 Jul 2023 17:24
by Jane
To uppercase the first character you can use:
Code: Select all
=Text(ToUpper(LeftText(Relationship(FileRoot(),,TEXT,1),1,"")) . MidText(Relationship(FileRoot(),,TEXT,1),2,0))
Re: Relationships
Posted: 22 Jul 2023 18:46
by arthurk
Thanks, Bill. I see that the Relationship function requires 4 parameters, the first two being references to Individuals, but in the version you've given the second one is empty. Please could you explain that?
Also, if the function requires 4 parameters, why does the simpler
=Relationship(FileRoot()) apparently work OK?
Re: Relationships
Posted: 22 Jul 2023 18:54
by arthurk
Jane wrote: ↑22 Jul 2023 17:24
To uppercase the first character you can use:
Code: Select all
=Text(ToUpper(LeftText(Relationship(FileRoot(),,TEXT,1),1,"")) . MidText(Relationship(FileRoot(),,TEXT,1),2,0))
Thanks, Jane - I thought there might be a way, but it would have taken me a while to find it by myself.
Re: Relationships
Posted: 22 Jul 2023 19:07
by BillH
arthurk wrote: ↑22 Jul 2023 18:46
Thanks, Bill. I see that the Relationship function requires 4 parameters, the first two being references to Individuals, but in the version you've given the second one is empty. Please could you explain that?
I think the function allows you to specify two individuals and it would give the relationship between them. I have never done this... so don't know how to code that. To be honest, I really don't know how it works. Someone gave me the code that I posted.
Also, if the function requires 4 parameters, why does the simpler =Relationship(FileRoot()) apparently work OK?
I guess if you don't specify all 4 parameters, then it uses some defaults. I'm not really sure.
Bill
Re: Relationships
Posted: 22 Jul 2023 19:16
by arthurk
Thanks - and hopefully someone else will be able to explain.
I'm not trying to be awkward, just wanting to understand, so when a term doesn't conform to what's described in Help I'm curious to know why it still works. Also why there are two versions - the simple one and the one with 4 parameters.
Re: Relationships
Posted: 22 Jul 2023 20:25
by tatewise
Unfortunately, the function documentation often does not explain that some parameters have default values which are used if explicit values are omitted. Also, sometimes parameters are optional.
In the case of Relationship(...) the first two parameters reference the individual records whose relationship is required.
By default, the current individual record is used if either parameter is omitted.
The third parameter defaults to TEXT and the fourth parameter defaults to 1.
Typically, the first value described in the documentation is the default value.
Re: Relationships
Posted: 22 Jul 2023 21:38
by BillH
Mike,
If you want to find the relationship between two individuals, how do you code the individuals in the function?
Thanks,
Bill
Re: Relationships
Posted: 23 Jul 2023 07:55
by Jane
The help for the function does detail the 4 parameters. The 1st and 2nd parameters will default to the current record when using a query so %INDI% and the example for using relationship does show all 4 parameters in use.
See
https://www.family-historian.co.uk/help ... nship.html
So you can also say
=Relationship(,FileRoot(),TEXT,1)
To get the relationship of the file root to the current person.
Re: Relationships
Posted: 23 Jul 2023 09:41
by arthurk
Thanks for the explanations - I can see what's going on better now.
Re: Relationships
Posted: 23 Jul 2023 09:50
by tatewise
BillH wrote: ↑22 Jul 2023 21:38
If you want to find the relationship between two individuals, how do you code the individuals in the function?
There are many ways to reference Individual records such as:
- %INDI% refers to the current Individual record if the context allows it.
- FileRoot() refers to the File Root Individual record which can be redefined from time to time.
- %CUR_FILE_OWNER% and %CUR_FILE_HEADER% refer to the Project owner and Header.
- Record( 345, "I" ) refers to an Individual record with Record Id 345.
- %INDI.~SPOU[2]% or %INDI.~CHIL[2]% and similar shortcuts refer to Individual records close to the current Individual.
- Plus many other data references to Individual records.
BTW: Those generally apply anywhere that an Individual record reference is required in a function.
However, a major omission from the Help for most functions is an explanation of what values are the defaults when the parameter is omitted. Perhaps that should be reported to CP or added as Wish List Request.
Re: Relationships
Posted: 23 Jul 2023 15:28
by BillH
tatewise wrote: ↑23 Jul 2023 09:50
There are many ways to reference Individual records such as:
<snip>
Plus many other data references to Individual records.
Mike,
Thanks for that. I looked all over for a list like this. The help for Relationship didn't mention what could be used. Are these other data references to Individual records listed somewhere?
Thanks,
Bill
Re: Relationships
Posted: 23 Jul 2023 16:31
by arthurk
I'm on a different tack from Bill, so apologies for seeming to butt in, but it does all stem from the original question.
This thread has emboldened me to improve my Property Box caption to include a number of variables. In case anyone would like to copy or adapt it, this is the code for the whole of the caption:
Code: Select all
%INDI%=CombineText(" (", %INDI.NAME[1]._USED%,")",)=CombineText(" ('", %INDI.NAME[1].NICK%,"')",) [=Text(ToUpper(LeftText(Relationship(FileRoot(),,TEXT,1),1,"")) . MidText(Relationship(FileRoot(),,TEXT,1),2,0))]=CombineText(" (", %INDI.REFN[1]%,")",)
As an example, my great grandfather's caption shows his Name, Nickname, Relationship to me, and his Custom ID:

- Screenshot 2023-07-23 165856.jpg (25.44 KiB) Viewed 1060 times
For someone not directly related to me (hence the empty
[ ]) it shows his Name and the Name he was known by. Because of the way I do things there's also no Custom ID.

- Screenshot 2023-07-23 170847.jpg (16.19 KiB) Viewed 1060 times
Many thanks to all those who have helped me with this.
Re: Relationships
Posted: 24 Jul 2023 10:09
by tatewise
BillH wrote: ↑23 Jul 2023 15:28
Thanks for that. I looked all over for a list like this. The help for Relationship didn't mention what could be used. Are these other data references to Individual records listed somewhere?
Those Data References won't be listed in the Help for any functions because they apply globally throughout FH.
It would be very repetitive to list them everywhere they might be useful.
Most of them are included in
Understanding Data References or the Help page it refers to.
The trick to discovering most of them is to use the Data Reference Assistance provide with almost all Expression boxes.
One of the easiest to use is the Fields pane on the left of the Query Columns tab.
e.g. Run the Query > Relatives and Relationships > All Individuals and open its Columns tab.
In the tiny droplist Menu bottom left choose Show Both in Box then select any of the last 8 entries in the Fields pane.
The Data Reference in the Box can be copied to any Expression.
The only options not listed by the method above are functions such as FileRoot() and Record(...) which you just have to learn.
However, the Dat Ref %CUR_FILE_ROOT% is the same as function FileRoot().
Re: Relationships
Posted: 24 Jul 2023 16:01
by BillH
Mike,
Thanks.
Bill
Re: Relationships
Posted: 26 Jul 2023 11:01
by ississi
Many thanks, BillH, that's great!
If you're interested in the relationship to a particular individual who may not be the root (I had to change my root for a bit, away from myself, because I'm female. I had to change it to a man, either something to do with charting or with queries, can't remember), then you need (for the simple caption):
Code: Select all
[=Relationship(Record(personid,"I"),,TEXT,1)]
where personid is their number, eg:
Code: Select all
[=Relationship(Record(390,"I"),,TEXT,1)]
Thank you tatewise for the clue.
Re: Relationships
Posted: 26 Jul 2023 15:40
by BillH
Thanks ississi, I'll give it a try.
Bill
Re: Relationships
Posted: 11 Aug 2023 05:04
by arishmell
I'm pleased with this new ability to display the relationship to root at the top of the Property Box. Now I'm wondering, is there any way to distinguish paternal/maternal lines as well? That would be such a help, especialy when there are common names on both sides.
Re: Relationships
Posted: 11 Aug 2023 10:42
by arthurk
arishmell wrote: ↑11 Aug 2023 05:04
Now I'm wondering, is there any way to distinguish paternal/maternal lines as well?
Someone might have a more sophisticated answer, but that's what I do with the Custom ID - up to a point. It's included in the code I posted on 23 July, 17:31 (UK).
All my direct ancestors from grandparents backwards have what is essentially an ahnentafel number based on their relationship to the grandparent concerned, preceded by the first letter of that grandparent's surname. I could in theory develop that so as to make derivative numbers for siblings and their descendants, but I've never felt the need.
If you wanted to use the Custom ID, there's probably an automatic way of inserting a paternal/maternal indicator, but it would take me much longer to work this out than for others to simply tell you. Or (thinking aloud as this isn't something I've tried) might it be possible to incorporate an appropriate wingding or other text-based icon in the caption, depending on which line someone comes from? Or something based on flags?
Re: Relationships
Posted: 12 Aug 2023 02:08
by sbell95
I've just had a play around with captions, expressions and data references, and this is the closest I could come to distinguishing maternal/paternal lines:
Code: Select all
=TextIf(DnaBloodRelation(Record(2),%INDI%), "Paternal", "Maternal")
where record ID 2 represents my father.
The only problem is that now my husband's entire line is marked as "Maternal"
I echo Arthur's sentiment that someone probably has a more sophisticated solution!