* Text Schemes in Diagrams

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
wulliam
Famous
Posts: 150
Joined: 03 Oct 2009 10:29
Family Historian: V7
Contact:

Text Schemes in Diagrams

Post by wulliam »

Hi,

I'm having my first serious attempt at customising the text in diagrams...and have been scratching my head for the past couple of hours.

The following is supposed to:
1) Output "Born: " if there is any birth data - either date or place
2) Output the birth date
3) Output ", " IF there is a birth date AND and birth place, otherwise output ""
4) Output birth place
5) Output "."

=ExistsText(%INDI.BIRT%,"Born: ")%INDI.BIRT.DATE:COMPACT%=TextIf(Exists(%INDI.BIRT.DATE%) and Exists(%INDI.BIRT.PLAC%),", ")%INDI.BIRT.PLAC:SHORT%.

It sort of works but, if there is no date it is determined to put a ", " before the place.

In addition, I also want "." to appear after the date if there is no place recorded...

I'm also wanting this for baptism, marriage, death and burial - but this one example should suffice.

Thanks for taking the time,

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

Re: Text Schemes in Diagrams

Post by tatewise »

Text Templates are cleverer than you realise.

To force the comma ", " and full-stop "." in the correct conditions needs:

Born: %INDI.BIRT.DATE:COMPACT%=ExistsText(%INDI.BIRT.DATE%,ExistsText(%INDI.BIRT.PLAC%,", "))%INDI.BIRT.PLAC:SHORT%=ExistsText(%INDI.BIRT%,".")

The first ExistsText nested pair will output ", " only if both DATE & PLAC exist.
The last ExistsText will ouput "." if the Birth Event exists.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Jane
Site Admin
Posts: 8518
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Text Schemes in Diagrams

Post by Jane »

Code: Select all

=ExistsText(%INDI.BIRT%,"Born: ")%INDI.BIRT.DATE:COMPACT%=TextIf(IsSet(%INDI.BIRT.DATE%) and IsSet(%INDI.BIRT.PLAC%),", ","")%INDI.BIRT.PLAC:SHORT%=TextIf(Exists(%INDI.BIRT%),".","")
Note the use of IsSet rather than exists, with Date fields they often exist and are blank when using the Fact Tab or importing. You can check this on the All Tab, using IsSet checks they have a value in them.

In text schemes leading and trailing text is conditioned on the previous expression, so a simple . will be dropped when there is no place.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
User avatar
Jane
Site Admin
Posts: 8518
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Text Schemes in Diagrams

Post by Jane »

I think Mike and I worked on this at the same time, just goes to prove there is always at least two ways to do everything in FH. :D
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
User avatar
wulliam
Famous
Posts: 150
Joined: 03 Oct 2009 10:29
Family Historian: V7
Contact:

Re: Text Schemes in Diagrams

Post by wulliam »

Thanks to you both - there are indeed more than one ways of skinning the proverbial cat.
Now to try to get the other events functioning in the same way :)

Thanks again,
William
William
User avatar
wulliam
Famous
Posts: 150
Joined: 03 Oct 2009 10:29
Family Historian: V7
Contact:

Re: Text Schemes in Diagrams

Post by wulliam »

I've used Jane's version and it's worked very nicely for Death and Burial. I've even managed to adapt it for Marriage.
However, for some reason I'm getting an error with the equivalent statement for Baptism. I'm using this:

=ExistsText(%INDI.BAPT%,"Baptised: ")%INDI.BAPT.DATE:COMPACT%=TextIf(IsSet(%INDI.BAPT.DATE%) and IsSet(%INDI.BAPT.PLAC%),", ","")%INDI.BAPT.PLAC:SHORT%=TextIf(Exists(%INDI.BAPT%),".","")

I don't understand why this fails when the others work - what am I missing??
William
User avatar
tatewise
Megastar
Posts: 28434
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Text Schemes in Diagrams

Post by tatewise »

That is because the Baptism tag is BAPM not BAPT.

You should use the <<Insert > Data Reference Assistant to get the basic data ref and then adapt the Template.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
wulliam
Famous
Posts: 150
Joined: 03 Oct 2009 10:29
Family Historian: V7
Contact:

Re: Text Schemes in Diagrams

Post by wulliam »

It's so simple when you know how...I've a lot to learn - thanks for your help tonight!
William
Post Reply