* Setting box features using data reference for DNA witness role

Questions about creating, customising and using diagrams and charts
Post Reply
User avatar
sbell95
Famous
Posts: 154
Joined: 14 Feb 2021 06:04
Family Historian: V7
Location: Australia

Setting box features using data reference for DNA witness role

Post by sbell95 »

I have a custom fact type DNA Match which includes the following witness roles: Match2, MRCA, DNA-Link and DNA-Link2. I would like to display some of these on a digram by applying box features, specifically those individuals who have a witness role of MRCA and/or DNA-Link.

Using this topic as a guide, I tried using the following Data Reference expression:

Code: Select all

=Exists(%INDI.EVEN-DNA_MATCH[1]._SHAR[1].ROLE% = "MRCA")
However, I am told that this is an invalid expression.

Is anyone able to assist with the correct syntax for accessing the MRCA and DNA-Link witness roles for the purposes of applying box features on a digram?

Thanks!
Sarah Bell – Australia
User avatar
Mark1834
Megastar
Posts: 2408
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Setting box features using data reference for DNA witness role

Post by Mark1834 »

I have a custom attribute, DNA Match (Ancestry), where the value is the relationship (First Cousin, etc), plus a custom diagram that highlights individuals where this is present by giving the box a yellow background.

My template for displaying this attribute is =FactText(%INDI._ATTR-DNA_MATCH_ANCESTRY[1+]%,"","A_DNA match (Ancestry): "), and I make the box yellow with a condition %INDI._ATTR-DNA_MATCH_ANCESTRY%, given the highest priority ranking.

It's simpler than your approach, but can you adapt it?
Mark Draper
User avatar
tatewise
Megastar
Posts: 28137
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Setting box features using data reference for DNA witness role

Post by tatewise »

Sarah, may I suggest you look at the FHUG Knowledge Base Understanding Expressions that gives examples of using both =Exists(...) and =IsTrue(...) functions.
=Exists(...) only allows one data reference parameter.
=IsTrue(...) requires an expression that returns true or false such as your %INDI.EVEN ... _SHAR[1].ROLE% = "MRCA"

So use =IsTrue( %INDI.EVEN-DNA_MATCH[1]._SHAR[1].ROLE% = "MRCA" ) to get a valid expression.

However, that only checks the first (i.e. _SHAR[1] of possibly several Fact Witness Roles.
So you may need several expressions for _SHAR[2] and _SHAR[3] et seq.

You say you also want to test for the Role "DNA-Link" so you need a compound expression such as below that must be entered all on one line:
=IsTrue(
( %INDI.EVEN-DNA_MATCH._SHAR[1].ROLE% = "MRCA" ) or
( %INDI.EVEN-DNA_MATCH._SHAR[2].ROLE% = "MRCA" ) or
( %INDI.EVEN-DNA_MATCH._SHAR[3].ROLE% = "MRCA" ) or
( %INDI.EVEN-DNA_MATCH._SHAR[4].ROLE% = "MRCA" ) or
( %INDI.EVEN-DNA_MATCH._SHAR[1].ROLE% = "DNA-Link" ) or
( %INDI.EVEN-DNA_MATCH._SHAR[2].ROLE% = "DNA-Link" ) or
( %INDI.EVEN-DNA_MATCH._SHAR[3].ROLE% = "DNA-Link" ) or
( %INDI.EVEN-DNA_MATCH._SHAR[4].ROLE% = "DNA-Link" ) )
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
sbell95
Famous
Posts: 154
Joined: 14 Feb 2021 06:04
Family Historian: V7
Location: Australia

Re: Setting box features using data reference for DNA witness role

Post by sbell95 »

tatewise wrote: 30 Nov 2023 10:41 Sarah, may I suggest you look at the FHUG Knowledge Base Understanding Expressions that gives examples of using both =Exists(...) and =IsTrue(...) functions.
Thanks Mike, that's a very useful knowledge base article!

Unfortunately, I could not get the box features to show using the %INDI.EVEN-DNA_MATCH[1]._SHAR[1].ROLE% = "MRCA" data reference. What did work was going the other way, ie, %INDI.~SHAR.ROLE% = "MRCA". I think this probably also does away with the need to include tests for all of the various indexes [2], [3], etc? And no other fact type I have includes an MRCA witness role, so there should be no conflicts.
Mark1834 wrote: 30 Nov 2023 10:02 I have a custom attribute, DNA Match (Ancestry), where the value is the relationship (First Cousin, etc), plus a custom diagram that highlights individuals where this is present by giving the box a yellow background.

My template for displaying this attribute is =FactText(%INDI._ATTR-DNA_MATCH_ANCESTRY[1+]%,"","A_DNA match (Ancestry): "), and I make the box yellow with a condition %INDI._ATTR-DNA_MATCH_ANCESTRY%, given the highest priority ranking.

It's simpler than your approach, but can you adapt it?
Thanks Mark, I already use a variation of this in my diagram, highlighing the DNA match themselves with box features using =Exists(%INDI.EVEN-DNA_MATCH%). What I wanted to show in addition to this is a pathway from the DNA match back to our common ancestor.

For anyone interested, this is what the final diagram looks like:
Screenshot 2023-12-01 133840.png
Screenshot 2023-12-01 133840.png (124.82 KiB) Viewed 1223 times
Sarah Bell – Australia
User avatar
sbell95
Famous
Posts: 154
Joined: 14 Feb 2021 06:04
Family Historian: V7
Location: Australia

Re: Setting box features using data reference for DNA witness role

Post by sbell95 »

OK, I may have jumped the gun :lol:

My logic does not seem to apply where a person is a witness to multiple DNA Match facts and is both a DNA-Link and a MRCA...
Sarah Bell – Australia
User avatar
Mark1834
Megastar
Posts: 2408
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Setting box features using data reference for DNA witness role

Post by Mark1834 »

I was experimenting with using Sarah's method of assigning the Most Recent Common Ancestor as a witness to the DNA match (which has a post-death normal time frame). I can display this correctly for the principal to force the undated fact to the bottom of the list (with a bit of careful editing), but for the witness there appears to be an inconsistency whereby FH puts the witness fact after dated facts in the Facts tab of the Property Box, but before dated facts in Reports! :?

I know there is a pending Wish List item for a normal time frame value of Last, but is there any way to resolve the inconsistent ordering of witness facts in FH as it is now?
Capture.PNG
Capture.PNG (26.13 KiB) Viewed 1191 times
Mark Draper
User avatar
tatewise
Megastar
Posts: 28137
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Setting box features using data reference for DNA witness role

Post by tatewise »

Sarah, OK, first some terminology that you may not have come across.
The person who has the DNA Match event (%INDI.EVEN-DNA_MATCH%) is called the Principal.
The person who is linked with a Role (%INDI.EVEN-DNA_MATCH._SHAR%) is called a Witness.
In FH, the Witness facts are listed on the Facts tab with a blue arrow icon on the left.

You originally asked about a Box Expression for any Principal with a DNA Match event with a Witness Role "MRCA".

Now you have realised you want a Box Expression for a DNA Match Witness who has the Role "MRCA".
The data reference %INDI.~SHAR% refers to the first Fact Witness entry for the person.
i.e. In that person's Facts tab, the first entry with a blue arrow icon on the left.
If the person was a Witness to multiple facts (multiple blue arrow icons) then there are multiple %INDI.~SHAR[n]% possibilities, so you need to test for:
(%INDI.~SHAR.ROLE% = "MRCA") or (%INDI.~SHAR[2].ROLE% = "MRCA") or (%INDI.~SHAR[3].ROLE% = "MRCA") or...

Unfortunately, the looping index [1+] is only supported in Text Schemes and not elsewhere.
If it were supported then %INDI.~SHAR[1+].ROLE% = "MRCA" would be sufficient.
I thought there was a Wish List entry for that enhancement but I could not find it.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
tatewise
Megastar
Posts: 28137
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Setting box features using data reference for DNA witness role

Post by tatewise »

Mark1834 wrote: 01 Dec 2023 10:12 I know there is a pending Wish List item for a normal time frame value of Last, but is there any way to resolve the inconsistent ordering of witness facts in FH as it is now?
Do Sort Dates help as a workaround?
i.e. Set the Sort Date year to 3000 to put them absolutely last.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Mark1834
Megastar
Posts: 2408
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Setting box features using data reference for DNA witness role

Post by Mark1834 »

That was the obvious thing to try, but DNA match is not a dated fact, and if you add the field to the fact definition, the Property Box displays the date of the DNA match as ______(s) for both the Principal and the Witness, which IMO is worse than an inconsistent report layout. At least the latter can be corrected post-production in a word processor.
Mark Draper
User avatar
sbell95
Famous
Posts: 154
Joined: 14 Feb 2021 06:04
Family Historian: V7
Location: Australia

Re: Setting box features using data reference for DNA witness role

Post by sbell95 »

tatewise wrote: 01 Dec 2023 10:35 Now you have realised you want a Box Expression for a DNA Match Witness who has the Role "MRCA".
The data reference %INDI.~SHAR% refers to the first Fact Witness entry for the person.
i.e. In that person's Facts tab, the first entry with a blue arrow icon on the left.
If the person was a Witness to multiple facts (multiple blue arrow icons) then there are multiple %INDI.~SHAR[n]% possibilities, so you need to test for:
(%INDI.~SHAR.ROLE% = "MRCA") or (%INDI.~SHAR[2].ROLE% = "MRCA") or (%INDI.~SHAR[3].ROLE% = "MRCA") or...

Unfortunately, the looping index [1+] is only supported in Text Schemes and not elsewhere.
If it were supported then %INDI.~SHAR[1+].ROLE% = "MRCA" would be sufficient.
I thought there was a Wish List entry for that enhancement but I could not find it.
Thank you - I have been using a text scheme item to include a notation that someone is a common ancestor, so that could work. However, using the looping index %INDI.~SHAR[1+].ROLE% = "MRCA" means that an individual could end up with multiple text items where they are the common ancestor witness on more than one shared DNA Match fact... is there a way to force FH to only print one instance of the text if there are several of the same?
Attachments
Screenshot 2023-12-02 111351.png
Screenshot 2023-12-02 111351.png (6.54 KiB) Viewed 1132 times
Sarah Bell – Australia
User avatar
tatewise
Megastar
Posts: 28137
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Setting box features using data reference for DNA witness role

Post by tatewise »

sbell95 wrote: 02 Dec 2023 00:14 Thank you - I have been using a text scheme item to include a notation that someone is a common ancestor, so that could work. However, using the looping index %INDI.~SHAR[1+].ROLE% = "MRCA" means that an individual could end up with multiple text items where they are the common ancestor witness on more than one shared DNA Match fact... is there a way to force FH to only print one instance of the text if there are several of the same?
It would help us if you posted the Text Scheme full template expression you currently use.

You could try:
=TextIf( %INDI.~SHAR[1+].ROLE% = "MRCA", "Common Ancestor", )

Otherwise, use the same technique as for the Boxes tab expression:
=TextIf( (%INDI.~SHAR.ROLE% = "MRCA") or (%INDI.~SHAR[2].ROLE% = "MRCA") or (%INDI.~SHAR[3].ROLE% = "MRCA") or (%INDI.~SHAR[4].ROLE% = "MRCA") or ... , "Common Ancestor", )
You just have to make sure there are enough (%INDI.~SHAR[n].ROLE% = "MRCA") references.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
sbell95
Famous
Posts: 154
Joined: 14 Feb 2021 06:04
Family Historian: V7
Location: Australia

Re: Setting box features using data reference for DNA witness role

Post by sbell95 »

Yes, my text scheme is using the expression you suggested of =TextIf( %INDI.~SHAR[1+].ROLE% = "MRCA", "Common Ancestor", ).

The problem is that the looping index [1+] returns each and every instance of an individual's witness roles, so for many people there are several DNA Match facts which have been shared with them as either the MRCA or DNA-Link, resulting in the duplication you see in my earlier attached image.

The technique you suggest which tests individually for each instance [2], [3], etc, would have to be quite long as it's impossible to know how many DNA Match facts I will ultimately add where an individual could be the MRCA witness. Hence my query about 'collapsing' any that are the same into a single text scheme item when using the looping [1+] index.

I guess this links back to Mark's query, because it seems that the sort order FH uses for the various witness roles is not consistent or editable. So some of my individuals who have both MRCA and DNA-Link shared witness roles have a property box that is mixed with both in an undetermined order, and therefore it is not possible to select only index [1], for example, and be certain that that will be a MRCA witness role.

A way around this that I am contemplating is the use of flags, but that seems like more work for something that should already be possible with my DNA Match fact, witnesses and data reference indices. Perhaps this is an area for the consideration of a wish list item if one does not already exist...
Sarah Bell – Australia
User avatar
Mark1834
Megastar
Posts: 2408
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Setting box features using data reference for DNA witness role

Post by Mark1834 »

Sarah, out of interest, what do your DNA-Link and DNA-Link2 signify please? MRCA is self-explanatory, but I'm not clear what the other roles are.
Mark Draper
User avatar
tatewise
Megastar
Posts: 28137
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Setting box features using data reference for DNA witness role

Post by tatewise »

Even if you knew the order of the Fact Witness Role = MRCA cases, the same person could have all manner of other Fact Witness entries for other Roles. I'm not sure in what order the %INDI.~SHAR% instances are listed.
I agree it is something of a puzzle.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
sbell95
Famous
Posts: 154
Joined: 14 Feb 2021 06:04
Family Historian: V7
Location: Australia

Re: Setting box features using data reference for DNA witness role

Post by sbell95 »

Mark, apologies, I should have explained more clearly. I have adapted a fact system originally designed by Bev Smallwood (another member of the FHUG and also the FHZG) where DNA-Link is the person or people in the 'chain' between a DNA match and our most recent common ancestor/s, and DNA-Link2 is the same type of 'chain' but between the test kit I manage and the common ancestor/s. There is also a witness role of Match2 which is assigned to the individual whose test kit matches the DNA match. Hopefully that's clear!
Sarah Bell – Australia
avatar
RS3100
Superstar
Posts: 251
Joined: 05 Nov 2020 12:16
Family Historian: V7
Location: Hertfordshire, UK

Re: Setting box features using data reference for DNA witness role

Post by RS3100 »

I don't know if this will help on a slightly different tack, but ignore if not!

I use a version of Jane's GEDmatch fact and associated query for DNA matches. I've set a box condition for individuals who have a GEDmatch fact, which adds a specific colour to the box border and displays a flag according to which test they match. I also created a named list in which I manually add the MRCAs, and another box expression which adds a different DNA icon to their chart boxes. If I want to view the chain between the test kit owner and the match, I just use the How Related function from the Chart menu in FH. Due to pedigree collapse in small rural communities, I have several matches where there may be two, three or more possible ways in which DNA may have been inherited, and it's not possible to say which one or more of the possible routes might be correct without the use of a chromosome comparison and sufficient other DNA tested relatives from each branch to make that comparison - something which is explained in text books but which in reality I have found impossible to do because of a lack of sufficient numbers of DNA tested relatives and/or an unwillingness or lack of interest amongst those who have tested, to cooperate.
User avatar
Mark1834
Megastar
Posts: 2408
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Setting box features using data reference for DNA witness role

Post by Mark1834 »

Thanks Sarah, clear. I think I will limit myself to recording the MRCA(s), as the DNA match doesn't fully support the identification of the intermediate links (they could be siblings).

As it is highly likely that the MRCA witness could have other witness roles (wedding witness, probate executor, etc), I'm thinking along the lines of a simple plugin that sets or clears a new "DNA Common Ancestor" flag according to whether an individual has such a witness role recorded against them. It would only have to be run occasionally, as DNA matches are updated, and it would greatly simplify diagram formatting.

GEDmatch is probably more than I need at the moment, as I am not particularly interested in wider extended families.
Mark Draper
User avatar
tatewise
Megastar
Posts: 28137
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Setting box features using data reference for DNA witness role

Post by tatewise »

The idea of using one or more Named Lists may be the best solution.
You could have one for MRCA and another for DNA-Links, etc.
Then the function =IsInList(%INDI%,"MRCA") can be used either as a Box Condition or in a Text Scheme template such as =TextIf( IsInList(%INDI%,"MRCA"), "Common Ancestor", )

The Named Lists may also be useful in other contexts.

They can be populated using a Query in the same way you were thinking of setting Flags.
See FHUG KB Named Lists.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Mark1834
Megastar
Posts: 2408
Joined: 27 Oct 2017 19:33
Family Historian: V7
Location: South Cheshire, UK

Re: Setting box features using data reference for DNA witness role

Post by Mark1834 »

Although I agree that it makes sense to maximise the "out of the box" options, the Query would be a bit clunky, as it has to check all the possible instances of this witnessed fact, and it seems a bit labour-intensive using the Query results to update list membership (not difficult, but it's a fair few clicks every time the data are changed).

I've been playing with a simple plugin that sets or clears a custom MRCA flag according to whether that person is identified as a Witness with that role, and that is literally one click if it is placed in the Tools menu. It wouldn't be too difficult to generalise it so users don't have to hard code it with their custom fact witness role descriptions.

Customising diagrams from flags seems to be even easier than from list membership, and in this case, the flag would not be made visible in either the Records Window or Property Box, as it should not be set manually.

Ideally, I would probably combine these approaches, and have a plugin manipulate list membership, but that is not possible at the present time, although CP have indicated that it might be a future revision.
Mark Draper
User avatar
sbell95
Famous
Posts: 154
Joined: 14 Feb 2021 06:04
Family Historian: V7
Location: Australia

Re: Setting box features using data reference for DNA witness role

Post by sbell95 »

As a quick update to this, I am now experimenting with Caroline O'Neill's approach by keeping individuals with a MRCA, DNA-Link or DNA-Link2 witness role in a Named List based on her suggestions in this post. That will allow the use of =IsInList in diagrams.

I'm not a huge user of Named Lists, so can anyone foresee any issues with this approach? Will FH warn me if I try to add the same individual twice to a Named List; or if they appear twice in a list, will a box/text condition with =IsInList only be executed once? Also, is there a way to sort a Named List based on date/time added to the list, in order to keep the most recently added items at the top? Or should I just ensure that no sort is applied after adding new individuals?
Sarah Bell – Australia
User avatar
tatewise
Megastar
Posts: 28137
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Setting box features using data reference for DNA witness role

Post by tatewise »

A record can only be added once to a Named List. Any second attempt will just be ignored.

Records are always added to the end of the Named List but the small black up/down arrows can adjust the order.

There is a Named List option to Keep Current List Order in the Lists menu or right-click on Named List name.

To satisfy my curiosity, why do they need to be kept in entry order?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
sbell95
Famous
Posts: 154
Joined: 14 Feb 2021 06:04
Family Historian: V7
Location: Australia

Re: Setting box features using data reference for DNA witness role

Post by sbell95 »

Thanks, Mike.

Keeping them in entry order ensures that one step in the process is kept as easy as possible. If all individuals who have a witness role of MRCA, DNA-Link or DNA-Link2 are added to and remain in the corresponding Named List, I want it to be easy to see the most recently added members of that list in order to select them to be assigned the appropriate role.

Especially for DNA-Link or DNA-Link2, the process of adding witnesses to the DNA Match fact involves first identifying the people in the "chain", adding them to the appropriate Named List and then adding them as a witness to the principal's DNA Match fact by selecting them from the records window Named List tab. If the Named List reverted to be alphabetic, for example, I would lose quick access to that "chain" in order to assign the witness roles.

That sounds as clear as mud, but hopefully you understand what I mean! :D
Sarah Bell – Australia
Post Reply