Page 1 of 1

Colour coding parts of a diagram?

Posted: 06 Mar 2012 14:21
by Merenwen
As I sat colouring in my husbands family tree over the weekend,I was wondering if there is an easy way you can have FH colour code branches of an ancestor diagram.

For those that don't want to read the whole story ( Paper Filing Systems (9789) ) here's the short version; I'm looking to colour the diagram boxes of all ancestors of the paternal grandfather blue, paternal grandmother green,  maternal grandfather red and maternal grandmother yellow.

I've not used FH for a while and I'm a bit rusty on the diagram options. Is there an easier (and more automatic) way than creating a flag for each colour, using a query to assign said flag and then using the box condition to colour the box based on the flag?

ID:5988

Colour coding parts of a diagram?

Posted: 06 Mar 2012 15:33
by johnmorrisoniom
You should be able to use a variation of the expression


=IsAncestorOf(FileRoot(), %INDI%)

But I don't know how to specify someone other than the file root

Colour coding parts of a diagram?

Posted: 06 Mar 2012 15:39
by Merenwen
That's the trouble, I'm looking at colouring different branches of the root persons ancestry different colours.

I wonder if you can replace 'File Root (), Ind%' with a set ID number? ie make the expression =IsAncestorOf ID8. I'll give it a try and let you know.

Colour coding parts of a diagram?

Posted: 06 Mar 2012 15:48
by Jane
I have a V5 script to see the colour flags, so once V5 is out if you are upgrading you can have it.

Alternately you could add 4 expressions one for each colour, but I suspect they would be pretty complex.

In the mean time. I'll see if I can work out the expression.

Colour coding parts of a diagram?

Posted: 06 Mar 2012 16:24
by Jane
Ok I have done it (I can't get it to work with the diagram root, but it's fine with the fileroot)

You need to add 4 expressions and they need to be in this order highest at the top

Code: Select all

Yellow
=IsAncestorOf(%INDI%,Field(FileRoot(),'INDI.FAMC>WIFE>FAMC>WIFE>')) 

Green
=IsAncestorOf(%INDI%,Field(FileRoot(),'INDI.FAMC>HUSB>FAMC>WIFE>')) 

Red
=IsAncestorOf(%INDI%,Field(FileRoot(),'INDI.FAMC>WIFE>'))

Blue
=IsAncestorOf(%INDI%,FileRoot())


Colour coding parts of a diagram?

Posted: 06 Mar 2012 16:51
by Merenwen
Thanks Jane, you're a star! I'd never worked that out myself. I can do basic queries, but that's about it.

And yes, I will be going to v5 when it comes out, so I would be very interested in that script.

Colour coding parts of a diagram?

Posted: 06 Mar 2012 21:49
by tatewise
The beauty of using Expressions rather than Flags is that they are always correct, whereas Flags have to keep on being added as you find ancestors.

Returning to your idea of using Record Id then Jane's Expressions would become:

=IsAncestorOf(%INDI%,Record(11,'I'))  Yellow
=IsAncestorOf(%INDI%,Record(22,'I'))  Green
=IsAncestorOf(%INDI%,Record(33,'I'))  Red
=IsAncestorOf(%INDI%,Record(44,'I'))  Blue

where Record Id 11, 22, 33, 44 are the ID for each appropriate grandparent.
The order of the Expressions is not important.

Colour coding parts of a diagram?

Posted: 06 Mar 2012 23:14
by johnmorrisoniom
I wish these examples were in the help file, instead of just the fileroot() examples.

Colour coding parts of a diagram?

Posted: 07 Mar 2012 09:51
by johnmorrisoniom
Thanks Mike
That works well, however these conditions 'Must' be placed higher than the 'Sex' option to work

Colour coding parts of a diagram?

Posted: 07 Mar 2012 11:07
by tatewise
The order of the Conditions is not important if they govern a different Box Feature.
I would not expect the Sex Condition to govern the same Box Feature as these Expression Conditions.
e.g.
I have Sex Highest in my list and governing Text Colour.
The Expressions for =IsAncestorOf(...) are lower Priority and govern Box Line colour & style.
Their order is not important.
I wish these examples were in the help file, instead of just the fileroot() examples.
Yes, more Examples would always be helpful, but even the MS Excel Help for Functions only gives one basic Example.
Chances are the extra Examples would rarely be the ones you want.

The Examples of FH Functions are probably meant to illustrate their syntax rather than usage.
Remember that every Function Parameter can generally be an Expression which might be:
1) a Number               e.g. 123
2) a Text String            e.g. 'Alphabet'
3) a Data Reference   e.g. %INDI.BIRT%
4) a Function               e.g. =RecordId()
5) any combination of the above
The Parameter description says what is allowed.
e.g.
The =IsAncestorOf(P1,P2) Function says both must be a Data Reference to an Individual record.
So Record(123,'I') refers to an Individual record and is allowed.
But Record(123,'S') refers to an Source record and is NOT allowed.
Note the two Parameters for =Record() are a Record Id Number and a single character Text String.

Look in the FH Help and Search for Expression for many associated topics.
Also Understanding Data References and Understanding Functions may help.