Page 1 of 1
Adding 'Relationship to Root' to Query
Posted: 01 Mar 2021 12:33
by rfj1001
I'm trying to improve how I can utilise FH to improve my DNA research and, probably like everyone else, I've got lots of 4th to 6th cousins spread in many areas of my tree. They all have DNA info, such as testing company, shared segments and emerging or actual MRCA entered in their record. They all also have a common flag, so the subset easily identified.
What I'm trying to do is create a query that shows the relationship of anyone in that group to the root person (who will be one of the DNA matches).
I've got all the query working except I can't seem to find out how to add the most important part - a 'Relationship to Root' column.
Any help would be appreciated.
Thanks
Re: Adding 'Relationship to Root' to Query
Posted: 01 Mar 2021 12:43
by tatewise
You need to use the =Relationship(...) function.
That identifies two Individual records whose relationship is required.
Usually, the two records are the FileRoot() and the current %INDI%
e.g. =Relationship( FileRoot(), %INDI%, TEXT, 1 )
But to identify a specific 'root' record other than the File Root use Record( 234, "I" ) where 234 is the Record Id of an "I" Individual record.
e.g. =Relationship( Record( 234, "I" ), %INDI%, TEXT, 1 )
But perhaps you are choosing that DNA root person via a prompt in the Query?
In that case use ["DNA Root"] where the prompt is for the DNA Root person.
e.g. =Relationship( ["DNA Root"], %INDI%, TEXT, 1 )
Re: Adding 'Relationship to Root' to Query
Posted: 01 Mar 2021 15:18
by rfj1001
Thanks Mike, the first works just fine

Re: Adding 'Relationship to Root' to Query
Posted: 07 Feb 2023 11:44
by Medows
Hi Mike,
I am a newbie to FH so still trying to understand data flow between the different query types. I have a Fact Query but I wanted to add a relationship to the root so I could prioritize my research. I applied "=Relationship( FileRoot(), %INDI%, TEXT, 1 )" to a Fact Query but got an error "Invalid expression for the current query type".
Alan
Re: Adding 'Relationship to Root' to Query
Posted: 07 Feb 2023 12:12
by jelv
As it is a fact query there isn't a current individual to use the expression you have so you have to get the owner of the fact. Try this:
=Relationship(FileRoot(),FactOwner(,1,MALES_FIRST),TEXT,1)
Re: Adding 'Relationship to Root' to Query
Posted: 07 Feb 2023 15:33
by Medows
Thank you John. That appears to have worked.
Re: Adding 'Relationship to Root' to Query
Posted: 07 Feb 2023 16:12
by jelv
Glad that helped.
When you have an issue like this it's always worth looking at the coding of the standard queries to see if they offer clues. I knew what was wrong with what you had, but had to look at the existing Facts and Events queries to get a clue to the solution.