Page 1 of 1

Ancestor Charts

Posted: 13 Oct 2020 10:59
by Mark183
Hello again Mike. Another Q please to which I cannot find an answer.
I want to implement a rule to colour all boxes in my diagrams & printed charts a different colour based upon country of birth, eg, born in Ireland I want the boxes to be green, born in England - red, born in Australia - blue, etc....
I have spent an inordinate time reading and playing but cannot work out how to do that. I am obviously an imbecile so if you could direct me to the appropriate search topic I would be appreciative. Ta. I can, of course, colour and format individual boxes, but want to create an automatic rule based upon place of birth. Can I do that?

Re: Ancestor Charts

Posted: 13 Oct 2020 15:08
by tatewise
I hope you are investigating the Diagram > Options > Boxes tab and its << Condition > Expression option.

So you need help composing each Expression to detect each country.
The first step is to use the << Insert Data Ref... button to the right of the Expression box.
Select Individual [+] Events [+] Birth [+] Place> and click OK to add %INDI.BIRT[1].PLAC>%
You can then choose a Box Fill colour and click OK, but not much will happen yet.

Now that refers to the person's Birth Place field, but you need to test if it contains a particular country.
That needs a function and Knowledge Base > Understanding Expressions gives advice.
The simplest solution is the =ContainsText(...) function.

So edit the Expression to be =ContainsText( %INDI.BIRT.PLAC>%, "England", STD )
Now that returns true and colours the box if England occurs anywhere in the Birth Place name.

There is a risk that some country names might occur in a Birth Place but not as the country.
e.g. 'Sydney, New South Wales, Australia' or 'England, Arkansas, USA' ~ both real places
So there is a better function as long as you have organised your Place names into standard coma separated parts.
e.g. Town, County, Country so that Country names are ALWAYS in the 3rd part.
You can check that in Tools > Work with Data > Places

So the function to extract the 3rd part is =TextPart( %INDI.BIRT.PLAC>%, 3, 1, STD )
However, that returns the name of the country and box Conditions need a true / false value.
Thus it needs wrapping in the =IsTrue(...) function like this:
=IsTrue( TextPart( %INDI.BIRT.PLAC>%, 3, STD ) = "England" )

Note that the = on TextPart has been dropped, which is explained in the KB advice, that also has examples like those above.