Page 1 of 1

DNABloodRelation expression

Posted: 15 Dec 2020 10:42
by Kingy
Hi

I hope this is ok, as new here.

I am trying to use the new DNABloodRelation expression ( =DnaBloodRelation(%CUR_TREE_ROOT%,%INDI%) ) to show the blood icon for all blood relatives of an individual.

The built in expression works well but displays for the individual on whom the diagram is built, but I would like to lock this to a single individual. I have tried using the =Hasflag(,["flag"] ) is true using the focus flag for the individual, but whatever I try I get an error Expession is invalid.

Is it possible to do what I am trying to do? Any help appreciated.

Thanks

Re: DNABloodRelation expression

Posted: 15 Dec 2020 11:38
by tatewise
Do you mean you want to use somebody other than the %CUR_TREE_ROOT%?

You can use =FileRoot() which relates to whoever is the current File Root person.
i.e. The person in focus in the Focus Window when you click the Home button.

You can use a specific Record Id where =Record( 99, "I" ) is the Individual with Record Id = 99.

BTW: When choosing parameters for a function it is important to get their data type correct.
All the above alternatives provide an Individual record reference which is what the DNABloodRelation requires:
Parameter 1: A reference to an Individual record.

Whereas, =HasFlag(...) returns a Boolean true or false which is the wrong data type.

Re: DNABloodRelation expression

Posted: 15 Dec 2020 12:13
by Kingy
Thanks

I have tried =DnaBloodRelation(=Record (1 "I"),%INDI%) but that gives error message each time, but the FileRoot method works fine.

That is a great help but I was hoping to do it for 2 individuals, so I assumed that using the record ID I could add 2 expresssions one for each person. So if you can see what I am doing wrong on that one it would help.

Thanks for help so far, greatly appreciated

Re: DNABloodRelation expression

Posted: 15 Dec 2020 12:39
by tatewise
When using a function as a parameter you must omit its leading = sign as you must have done with FileRoot().
You also forgot the comma between 1 and "I" parameters.

=DnaBloodRelation( Record( 1 , "I" ), %INDI% )

It is a pity that FH does not provide a basic syntax check feedback report.

Re: DNABloodRelation expression

Posted: 15 Dec 2020 12:57
by Kingy
Excellent, thanks ever so much. :D :D :D

Paul

Re: DNABloodRelation expression

Posted: 19 Feb 2021 17:04
by Kingy
Mike

I am just playing with this in the text scheme. The default is
=Text(FormatFloat(DnaRelatedness(%CUR_DGM_ROOT%,%INDI%) * Float(100),2,16) . "% atDNA")

But as we did above I want it to be locked to myself as an Individual and not the current root, so I have tried
=Text(FormatFloat(DnaRelatedness(Record(1,ā€Iā€),%INDI%) * Float(100),2,16) . "% atDNA")
but this is rejected each time.

Can you see where I am going wrong or will this not work as I am hoping.

Regards

Re: DNABloodRelation expression

Posted: 19 Feb 2021 18:08
by tatewise
It seems to work for me as long as the quotes are simple quotes and not smart quotes.
If you look closely your quotes are different from the ones in the earlier posting.
Did you compose the expression in a word-processor that typically use smart quotes?
In the Text Scheme Template expression delete the quotes and enter them again from the keyboard.

Re: DNABloodRelation expression

Posted: 19 Feb 2021 18:45
by Kingy
Yes working now, another lesson learnt.

Thanks
Paul