* custom dates for btw and non btw combination

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
avatar
piotao
Gold
Posts: 18
Joined: 28 Aug 2018 14:09
Family Historian: V6

custom dates for btw and non btw combination

Post by piotao » 12 Sep 2018 00:44

Hi,
I would like to have a diagram line with Birth Date, but configured in a way, where there is "YEAR PLACE" text only when date is precisely known and "YEAR1 - YEAR2 PLACE" where data is know approximately or given as a "between" period.
Example:
birth is entered as between 1850-1870 in City
or
birth is entered as 15 May 1866 in City

In the first case I should have text like this: "1850-1870, City"
in the 2nd case there should be text like: "1866, City".

I cannot do that for some reason. I get up to the formula:

Code: Select all

=TextIf(%INDI.BIRT.DATE:XDATE1%=%INDI.BIRT.DATE:XDATE2%,%INDI.BIRT.DATE:XDATE1%,Text(%INDI.BIRT.DATE:XDATE1%."-".%INDI.BIRT.DATE:XDATE2%))
But it doen't work; however, the simpler, single formula in the "false" part of TextIf works:

Code: Select all

=TextIf(%INDI.BIRT.DATE:XDATE1%=%INDI.BIRT.DATE:XDATE2%,%INDI.BIRT.DATE:XDATE1%,%INDI.BIRT.DATE:ABBREV4%)
but it works as I like only when dates are entered only with year. Precise dates like in the example above show full date which is not desired.

How to make this simpler and working?

INSTANT EDIT: I've found the formula:

Code: Select all

=TextIf(%INDI.BIRT.DATE:XDATE1% = %INDI.BIRT.DATE:XDATE2%,Year(%INDI.BIRT.DATE:XDATE1%),%INDI.BIRT.DATE:ABBREV4%)
now, the default birth for date and place prints:
Born: btw 1825 and 1835 in Ławaryszki
and my expression prints:
1825-1835, Ławaryszki
while for precise dates:
Born: Feb 18, 1919 in Ławaryszki
and my exp:
1919, Ławaryszki
which seems to be working, but is it OK? Can't it be simpler?

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

Re: custom dates for btw and non btw combination

Post by tatewise » 12 Sep 2018 09:41

You have clearly grasped the details of creating expressions.

The reason Text(%INDI.BIRT.DATE:XDATE1% . "-" . %INDI.BIRT.DATE:XDATE2%) was invalid in your first expression is that all forms of Date are not of type Text and thus are not valid parameters to the Text(...) function.
You must force their type by using one of the type-specifier conversion functions, in this case Text(...) as follows:
Text( Text(%INDI.BIRT.DATE:XDATE1%) . "-" . Text(%INDI.BIRT.DATE:XDATE2%) )

If the ABBREV4 qualifier was not available to produce exactly the format you needed, then the Year(...) function would:
Text( Text(Year(%INDI.BIRT.DATE:XDATE1%)) . "-" . Text(Year(%INDI.BIRT.DATE:XDATE2%)) )

BUT, does ABBREV4 produce what you want for Quarter Dates or any other Date Range/Period where both years are the same?
e.g. Q2 1867 or from 1 Jan 1867 to 1 Dec 1867 both produce 1867-1867

To avoid that use the Year(...) expression in the condition:
=TextIf( Year(%INDI.BIRT.DATE:XDATE1%) = Year(%INDI.BIRT.DATE:XDATE2%), ...)

Otherwise, that expression is about as simple and elegant as it can be and I guess the full expression is:
=TextIf(Year(%INDI.BIRT.DATE:XDATE1%) = Year(%INDI.BIRT.DATE:XDATE2%), Year(%INDI.BIRT.DATE:XDATE1%), %INDI.BIRT.DATE:ABBREV4%), %INDI.BIRT.PLAC%

The only minor comment is that when there is no Date at all then there is a redundant leading , comma & space.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
piotao
Gold
Posts: 18
Joined: 28 Aug 2018 14:09
Family Historian: V6

Re: custom dates for btw and non btw combination

Post by piotao » 12 Sep 2018 22:34

Thank you for your kind words and clarification. I've used your version and it works perfectly. Also, I've split place and date to separate parts so no more hanging comma appears, only space if dates are empty.

Here is a finished example (I'm unsure if I manage to upload a picture).
exampleofformat.jpg
exampleofformat.jpg (40.13 KiB) Viewed 2348 times

Post Reply