* Using the =GetLabelledText function

Questions regarding use of any Version of Family Historian. Please ensure you have set your Version of Family Historian in your Profile. If your question fits in one of these subject-specific sub-forums, please ask it there.
Post Reply
User avatar
laz_gen
Famous
Posts: 150
Joined: 03 Apr 2018 14:02
Family Historian: V7
Contact:

Using the =GetLabelledText function

Post by laz_gen » 14 Mar 2023 07:24

I previously received some forum help to create a query to find my DNA matches recorded in a custom fact and display their relationship to me. I would now like to expand that query as I add a lot more DNA matched individuals.

The custom fact holds the Ancestry user name of the DNA match within its primary field and within the Note field I have created some pseudo data fields:

cM Value: Numeric value
Common Ancestors: (hyperlinks to the common ancestors within my FH file)

I have been trying to extract the pseudo data fields from the facts using the =GetLabelledText function with the hope that I could sort the query output on the Common Ancestors column to group them together.

=GetLabelledText(%INDI._ATTR-DNA_MATCH_R.NOTE2%,"cM Value: ")
=GetLabelledText(%INDI._ATTR-DNA_MATCH_R.NOTE2%,"Common Ancestors: ")

The function works OK in extracting the cM value as that is plain text but it does not work on any line containing rich text (hyperlinks) as explained in the help file, so doesn't extract the Common Ancestors.

This is from the help file - Note: paragraphs within tables (in rich text notes) are not searched or matched by this function.

The only solution I have found is to repeat the Common Ancestors pseudo data field twice: once as plain text and once as rich text with the plain text preceding the rich text so the query search finds it first.

Is there a text search function that will extract rich text?
Does anyone have any alternative ideas how I may achieve this?

avatar
jelv
Superstar
Posts: 365
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Re: Using the =GetLabelledText function

Post by jelv » 14 Mar 2023 08:27

Are you wanting links to the individual or family within FH or hyperlinks to a web page?

In my note for the DNAMatch I have:

Shared Ancestor:
Shared Couple:

where I enter the individual's id no. or the family no.

The columns in my query are:

=Record(TextToNumber(GetLabelledText(%FACT.NOTE2%,"Shared Couple:")),"F")
=Record(TextToNumber(GetLabelledText(%FACT.NOTE2%,"Shared Ancestor:")),"I")

I got this from (I think) something Jane posted about recording DNA matches.
John Elvin

User avatar
laz_gen
Famous
Posts: 150
Joined: 03 Apr 2018 14:02
Family Historian: V7
Contact:

Re: Using the =GetLabelledText function

Post by laz_gen » 14 Mar 2023 08:50

Perhaps I didn't fully explain my wishes.

As for the details in the custom fact note pdeudo field the INDI hyperlinks are important so I can jump straight to that individuals property box details.

As for the query I was hoping to display the names of the common ancestors so I can sort on that column and see all those descended from the common ancestors grouped together.

I do have an extra pseudo field to hyperlink directly to the Ancestry DNA link page but that is used only in the fact note field and is not important to the query.
Last edited by laz_gen on 14 Mar 2023 09:12, edited 1 time in total.

User avatar
laz_gen
Famous
Posts: 150
Joined: 03 Apr 2018 14:02
Family Historian: V7
Contact:

Re: Using the =GetLabelledText function

Post by laz_gen » 14 Mar 2023 09:09

Forgot to add I had found the TextToNumber function and applied it to my cM values so they now sort as numbers instead of the previous sorting as characters.

=TextToNumber(GetLabelledText(%INDI._ATTR-DNA_MATCH_R.NOTE2%,"cM Value: "))

avatar
jelv
Superstar
Posts: 365
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Re: Using the =GetLabelledText function

Post by jelv » 14 Mar 2023 09:09

The connecting ancestor example I gave does display the name, you can click the column heading to sort and with one of the names highlighted you can click focus in the tool bar.
John Elvin

avatar
jelv
Superstar
Posts: 365
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Re: Using the =GetLabelledText function

Post by jelv » 14 Mar 2023 09:17

Although the shared couple code I gave does display the couple and from there you can open the property box, getting to the family in the focus window from there is more than one step. I'm thinking of changing to have Shared Ancestor 1 and Shared Ancestor 2, normally both would be entered but in the case of half siblings there would only be one.
John Elvin

User avatar
laz_gen
Famous
Posts: 150
Joined: 03 Apr 2018 14:02
Family Historian: V7
Contact:

Re: Using the =GetLabelledText function

Post by laz_gen » 14 Mar 2023 11:16

John

Thanks for your advice.

I think I am getting nearer to a solution and if I store the shared ancestor INDI number in the fact pseudo field instead of their name then the number gets extracted, converted into a proper %INDI% and displays a clickable link to the person in the column of the query result.

I can also sort on that column to group them together which is what I wanted.

=Record(TextToNumber(GetLabelledText(%INDI._ATTR-DNA_MATCH_R.NOTE2%,"Shared Ancestor:")),"I")

The only thing I can't show in the query result set is the external web link to the Ancestry DNA web page for the matched person however I am happy for that to stay as a normal web link in its own pseudo field within the fact note.

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Using the =GetLabelledText function

Post by tatewise » 14 Mar 2023 11:22

I don't really understand why =GetLabelledText(...) does not work because the very similar =GetParagraph(...) works fine.
The following discussion assumes the first two lines of the DNA Match Note has this structure:
cM Value: 3
Common Ancestors: John SMITH Jane JONES
Ancestry Web Page: https:\\ancestry.com...



=MidText( GetParagraph( %INDI._ATTR-DNA_MATCH_R.NOTE2%, 2 ), 18, 0 ) does return John SMITH Jane JONES
i.e. The 2nd paragraph text of the names of the linked people is returned, so why not with =GetLabelledText?
You could try asking CP.

However, to avoid the possibility of a DNA Match fact without a labelled Note you could test for the Cm Value label.
=TextIf( TextLen( GetLabelledText(%INDI._ATTR-DNA_MATCH_R.NOTE2%,"cM Value: ") ) > 0, MidText(GetParagraph(%INDI._ATTR-DNA_MATCH_R.NOTE2%,2),18,0), )

It is not entirely clear how sorting on the multiple names in the Common Ancestors column would work.
The sorting would be applied primarily to the forenames of the first person listed.
Unless that is, you have entered Text for each record link and used a surname first format.
But that still only sorts on the surname of the first person listed.

A similar technique works for the Ancestry link:
=TextIf( TextLen( GetLabelledText(%INDI._ATTR-DNA_MATCH_R.NOTE2%,"cM Value: ") ) > 0, MidText(GetParagraph(%INDI._ATTR-DNA_MATCH_R.NOTE2%,3),10,0), )
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
jelv
Superstar
Posts: 365
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Re: Using the =GetLabelledText function

Post by jelv » 14 Mar 2023 11:55

I've changed to have two individuals instead of the couple as it works better for me. This is an example of the note I'm now using
[[
Tested with: Ancestry
Name on Test Site: xxxxxxxxx
GedMatch Details
Kit Id:
GedMatch Name:

Shared Ancestors
Male: 329
Female: 60
Primary Link: 1
]]

[[
Match details
Shared DNA: 45 cM across 5 segments
Unweighted shared DNA: 76 cM
Longest segment: 26 cM
]]
The primary link is my own record id, if my wife tests and gets matches it would be hers.

I've attached my updated query. Here's a sample of the result set:
DNA query example.png
DNA query example.png (26.34 KiB) Viewed 1043 times
Attachments
DNA Match - All Facts 2.fhq
(2 KiB) Downloaded 20 times
John Elvin

User avatar
laz_gen
Famous
Posts: 150
Joined: 03 Apr 2018 14:02
Family Historian: V7
Contact:

Re: Using the =GetLabelledText function

Post by laz_gen » 14 Mar 2023 12:08

There does seem to be a discrepancy in these text functions.

At present I have these common ancestors stored as INDI hyperlinks in my custom fact notes.

=GetLabelledText refuses to extract the names presumably because they are rich text (as stated in the help file)

=GetParagraph does seem to extract the names as I would like.

I could store these common ancestors numerically (their INDI number) in the note field and extract/convert as John Elvin suggested but seeing the INDI numbers is not as readable as seeing the full names as hyperlinks.

I think I will go with storing the full names as hyperlinks as in the present form of "John Doe & Jane Doe", use =GetParagraph to extract them in the query and show that detail as plain text in the Common Ancestor column.

The sorting and grouping of these ancestors is adequate for my needs, i.e. to see small clusters of individuals descended from a common pair of ancestors.

I will pose the question to CP about the function discrepancy.

Thanks to all for the help.

User avatar
laz_gen
Famous
Posts: 150
Joined: 03 Apr 2018 14:02
Family Historian: V7
Contact:

Re: Using the =GetLabelledText function

Post by laz_gen » 14 Mar 2023 12:09

John

Only just seen your lengthy reply.

Thanks you for that, I will download your query and see how I could make it work for me.

Robin

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Using the =GetLabelledText function

Post by tatewise » 14 Mar 2023 12:12

The restriction in the Help for GetLabelledText only applies to labels inside Rich Text Tables in Note fields.
It does NOT apply to other labels in Rich Text outside Tables in Note fields
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
laz_gen
Famous
Posts: 150
Joined: 03 Apr 2018 14:02
Family Historian: V7
Contact:

Re: Using the =GetLabelledText function

Post by laz_gen » 14 Mar 2023 16:16

The restriction in the Help for GetLabelledText only applies to labels inside Rich Text Tables in Note fields.
It does NOT apply to other labels in Rich Text outside Tables in Note fields
Mike

Maybe I was doing something wrong but I couldn't get =GetLabelledText function to extract text from INDI hyperlinks whereas your suggestion to use =GetParagraph worked first time.

User avatar
tatewise
Megastar
Posts: 27078
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Using the =GetLabelledText function

Post by tatewise » 14 Mar 2023 17:08

The point is that even labelled plain text inside a Rich Text Table will not be found by =GetLabelledText(...)
None of your data is inside a Rich Text Table so that restriction is irrelevant, so please ignore it for this discussion.

The discrepancy between =GetLabelledText(...) and =GetParagraph(...) when a record hyperlink follows the label needs to be explained by CP and you said you will ask them.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
laz_gen
Famous
Posts: 150
Joined: 03 Apr 2018 14:02
Family Historian: V7
Contact:

Re: Using the =GetLabelledText function

Post by laz_gen » 15 Mar 2023 07:46

I think I have now worked out how I will use the various suggestions

My fact note field will look like this

[[
cM Value:345
Male:John Doe
Male ID:123
Female:Jane Doe
Female ID:124
Link:Ancestry DNA
]]

My query functions will be:

%INDI%
%INDI._ATTR-DNA_MATCH_R[1]%
=Relationship(Record(XX,"I"),,TEXT,1)
=RelationCode(Record(XX,"I"),,GENERATION,1)
=Record(TextToNumber(GetLabelledText(%INDI._ATTR-DNA_MATCH_R.NOTE2%,"Male ID: ")),"I")
=Record(TextToNumber(GetLabelledText(%INDI._ATTR-DNA_MATCH_R.NOTE2%,"Female ID: ")),"I")

Additionally I have mofified the Fact Type Advanced field to show "Descended from John Doe & Jane Doe" in the Property Box using
Descended from {=MidText(GetParagraph(%FACT.NOTE2%,2),7,0)} & {=MidText(GetParagraph(%FACT.NOTE2%,4),9,0)}

I think this all gives me the best use of the data. From the property box I can see the common ancestors names even if the DNA fact is not selected. When the fact is selected the note field shows hyperlinks to both common ancestors plus a web link to the Ancestry page for the DNA matched person.

The query when run lists all relevant information plus contains clickable links to the common ancestors.

My thanks to John & Mike for their help and suggestions.

I have reported the function discrepancies to CP, I will post their reply.

User avatar
laz_gen
Famous
Posts: 150
Joined: 03 Apr 2018 14:02
Family Historian: V7
Contact:

Re: Using the =GetLabelledText function

Post by laz_gen » 15 Mar 2023 12:49

The response from Calico Pie...

Thank you for reporting this issue (i.e. that =GetLabelledText() is not rendering record links as plain text but simply excluding them altogether). We have confirmed the issue. It will be fixed in the next update. I have made to contact you when the next update is available.

Martin

Family Historian Support
Calico Pie

avatar
jelv
Superstar
Posts: 365
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Re: Using the =GetLabelledText function

Post by jelv » 15 Mar 2023 13:04

I've just modified my DNAMatch event to show the common ancestors in the Sentence getting them from the id numbers. This does have the advantage that when I add the DNA Match I can instantly see if I have added the correct numbers and means that they are visible without having to add the actual names to the note.
John Elvin

User avatar
laz_gen
Famous
Posts: 150
Joined: 03 Apr 2018 14:02
Family Historian: V7
Contact:

Re: Using the =GetLabelledText function

Post by laz_gen » 15 Mar 2023 16:59

John

You have given me a further thought about what I am actually recording in the note box and how I could reduce it a little.

I do like to see the common ancestors names in the note box and as links I can click to jump to them so didn't really want to give that up. To get that to work I intended recording both a name and an ID number but I can see I can achieve everything from just the ID numbers.

Like yourself I can use the fact sentence to see the common ancestors (in text) and use the ID numbers for the query as before so ca do it all without typing the names.

Thanks for that reply, it's good to bounce ideas off each other!

Post Reply