Page 1 of 1
Ordering Individuals by DOB
Posted: 06 Nov 2017 21:52
by RogerF
Looking at the Individuals window, displayed ordered by Dates, it would be very useful if the records were presented in a consistent order: that is (for each year) births in that year, then that year (approximately), finally that year (estimated). Currently, the order within each year seems to be fairly random. Have I missed some config option which would give what I want?
Re: Ordering Individuals by DOB
Posted: 06 Nov 2017 23:06
by tatewise
The Dates column is usually defined as =LifeDates(,STD) which is a summary of life dates that may include Date of Birth, Baptism, Christening, Death, Burial or Cremation.
I think you will find that they are sorted according to the full date, taking the day & month into account as well as year.
Those without a day or month will assume the 1st and January respectively.
If it were defined as =Text(LifeDates(,STD)) then the displayed text will be sorted strictly alphanumerically.
But that will group all bap. dates, then chr. dates, and then c. dates together after all the numerical years.
It might be possible to construct an Expression that shows just the Year of Birth/Baptism/Christening followed by whether Approx, Calculated, or Estimated, but gets quite involved with several nested TextIf(...) functions.
e.g.
=TextIf( Exists(%INDI.BIRT.DATE%), Text( Text(Year(%INDI.BIRT.DATE%)) . " " . TextIf( %INDI.BIRT.DATE:XDATETYPE% = "Date", "", Text(%INDI.BIRT.DATE:XDATETYPE%) ) ), TextIf( Exists(%INDI.BAPM.DATE%), Text( Text(Year(%INDI.BAPM.DATE%)) . " " . TextIf( %INDI.BAPM.DATE:XDATETYPE% = "Date", "", Text(%INDI.BAPM.DATE:XDATETYPE%) ) . " bap." ), TextIf( Exists(%INDI.CHR.DATE%), Text( Text(Year(%INDI.CHR.DATE%)) . " " . TextIf( %INDI.CHR.DATE:XDATETYPE% = "Date", "", Text(%INDI.CHR.DATE:XDATETYPE%) ) . " chr." ), "" ) ) )
i.e.
If Birth Date then show Birth Year & Birth Date Type
else
if Bapt Date then show Bapt Year & Bapt Date Type & " bap."
else
if Chr Date then show Chr Year & Chr Type & " chr."
BUT that Expression is greater than the maximum characters allowed for a Column!
So this one is just short enough, although not quite so tidy:
=TextIf(Exists(%INDI.BIRT.DATE%),Text(Text(Year(%INDI.BIRT.DATE%)).TextIf(%INDI.BIRT.DATE:XDATETYPE%="Date","",Text(%INDI.BIRT.DATE:XDATETYPE%))),TextIf(Exists(%INDI.BAPM.DATE%),Text(Text(Year(%INDI.BAPM.DATE%)).TextIf(%INDI.BAPM.DATE:XDATETYPE%="Date","",Text(%INDI.BAPM.DATE:XDATETYPE%))." bap"),TextIf(Exists(%INDI.CHR.DATE%),Text(Text(Year(%INDI.CHR.DATE%)).TextIf(%INDI.CHR.DATE:XDATETYPE%="Date","",Text(%INDI.CHR.DATE:XDATETYPE%))." chr"),"")))
Re: Ordering Individuals by DOB
Posted: 07 Nov 2017 08:03
by RogerF
Thanks, Mike. It should be possible to simplify matters: everybody in my database has a DOB; if I haven't yet discovered a true date I supply an estimate. So we need look only at%INDI.BIRT.DATE%; perhaps something like:
=TextIf( Exists(%INDI.BIRT.DATE%), Text( Text(Year(%INDI.BIRT.DATE%)) . " " . Text(%INDI.BIRT.DATE:XDATETYPE%) ) ), , "" ) ) )
but I'm unsure about the bit at the end, and clearly the parentheses are unbalanced.
Re: Ordering Individuals by DOB
Posted: 07 Nov 2017 10:12
by tatewise
Roger, if only interested in DoB then you don't need the =TextIf(...) at all, just the Text(...) function.
i.e.
=Text( Text(Year(%INDI.BIRT.DATE%)) . " " . %INDI.BIRT.DATE:XDATETYPE% )
That is OK even if there is no DoB and just yields a single space.
However, the XDATETYPE qualifier not only yields Approx, Calculated & Estimated, but also Date for a simple date, and Before or After or Between for a Range or Quarter Date, so the order for identical years would be:
After
Approx
Before
Between
Calculated
Date
Estimated
To eliminate Date so simple dates come first , replace %INDI.BIRT.DATE:XDATETYPE% with:
TextIf( %INDI.BIRT.DATE:XDATETYPE% = "Date", "", Text(%INDI.BIRT.DATE:XDATETYPE%) )
Re: Ordering Individuals by DOB
Posted: 07 Nov 2017 10:31
by RogerF
Excellent! Thanks again, Mike.