Page 1 of 1
Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 18:25
by Chrisv
In my Source Records window, I have a date column I would like to be able to sort chronologically. Is there a way to accomplish this?
Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 18:53
by Gowermick
Just click on the column heading to sort into ascending order, and Alt- click for descending order.
This applies to most lists, including query resultsets.
Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 19:20
by Chrisv
Thank you Gowermick!
If I sort using the Column Header and with the dates in their "normal" format, they do not sort by chronological date because they are listed, for example, as April 19, 1895, which will sort by the Month, Day, Year. I would like them to sort by Year, Month, day, so they are listed chronologically.
Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 20:28
by tatewise
Chris, is your date column actually a formal Date column or is it just a Text column that looks like a date?
Please, show us the Expression that defines the column contents.
Only Date fields will sort chronologically. Text fields will sort alphanumerically.
i.e. When you say it sorts by the Month, Day, Year does it sort in this order:
April
August
December
February
January
July
June
March
May
November
October
September
Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 20:51
by Chrisv
Here you go...
and yes, that is how it is sorting.
Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 21:25
by tatewise
Whoops

I must be mistaken. I was sure that Date fields would sort chronologically.
So one option is to use
%SOUR.~DT-EVENT_DATE:ABBREV3% that uses the Short Date Format.
Then in
Tools > Preferences > General tab set
Preferred Short Date Format to
yyyy/mm/dd or
yyyy-mm-dd
However, it is still not always strictly chronological because the leading 0 on months and days 1 to 9 are omitted.
So the months Oct (10) to Dec (12) sort between Jan (1) and Feb (2).
The days 10-19 sort between 1 and 2, days 20-29 sort between 2 and 3, and 30-31 sort between 3 and 4.
Therefore, the only complete solution seems to need two columns:
%SOUR.~DT-EVENT_DATE%
=DayNumber(%SOUR.~DT-EVENT_DATE%) is the number of days since January 1st, 0001 AD
Sorting by the 2nd column will put the records in chronological order.
I wonder if the failure to sort Date field columns chronologically should be reported to CP.
Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 21:44
by Chrisv
I could swear that I saw somewhere something about sorting dates - No, wait... It was a way to turn the date field so it would read for e.g. 1884/08/23, or something like that. Or maybe it was somebody wishing it would be that way??
I would think this would be an important option!
Oh well, I appreciate you trying. I will just move on to more important things...
Thanks Mike!
Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 21:53
by Gowermick
Mike,
That is unusual, I always thought it was a standard computing practise to store dates internally as integers, representing days from some inbuilt fixed date. These integers are then converted to the preferred date display option when required i.e US (MMDDYYY) versus UK (DDMMYYY) formats.
This problem doesn’t appear to occur when sorting facts by their dates in the property box, (at least, not that I’ve noticed)

Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 22:04
by tatewise
There have been various suggestions about achieving yyyy/mm/dd format dates but they all suffer from the leading 0 problem for single-digit months and days.
As Mike suggests, on further investigation, I find standard FH/GEDCOM fields that are specified as Dates do automatically sort chronologically regardless of the display format, e.g. Fact Dates, Citation Entry Dates, etc.
I suspect FH uses the =DayNumber(...) function internally to perform the sorting.
The problem Chris has discovered only affects source template defined Date (DT) metafields.
I really do think it should be reported to CP, as I consider that is an oversight that should be fixed.
FH recognises such Date metafields because it allows Date qualifiers such as :ABBREV3.
So it is just the sorting that has not been implemented.
Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 22:40
by Chrisv
Is this a new problem with FH7, or has this been an omission since FH's inception? It's hard to believe I am the first to run into this, but I did search everywhere and did not come up with any discussions of references.
What is the process to report problems to FH?
Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 23:10
by BillH
Chris,
There is a link at the bottom of the support page on the FH website,
https://www.family-historian.co.uk/supp ... t-overview.
Here is a direct link to the form for submitting issues,
http://support.calico-pie.com/open.php.
Bill
Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 23:46
by Chrisv
Thank you Bill.
I will fill out the necessary report. Since this is my first time reporting something to CP, would it be a good idea, Mike, if you would also make a much more informed report of the problem?

Re: Source Records Window, Chronological Date Sorting
Posted: 22 Apr 2022 23:57
by BillH
Chris,
You can refer to this post in your ticket which has more detail.
If you are not already aware you can click on the asterisk at the beginning of the title for this topic which will create a link and then you can cut and paste that link into your ticket.

- image1.jpg (22.75 KiB) Viewed 1666 times
Bill
Re: Source Records Window, Chronological Date Sorting
Posted: 23 Apr 2022 00:22
by Chrisv
I created a support ticket stating the facts as per the conversation in this thread; asking for confirmation of the problem, and that they please consider fixing the problem now, or at least in the next release version.
I'll post what I find out.
Re: Source Records Window, Chronological Date Sorting
Posted: 23 Apr 2022 08:04
by Mark1834
There was a similar issue with Research Notes when they were first introduced (again, a new FH7 feature). The note date was processed as text, so sorted alphabetically rather than chronologically. That was fixed by changing the default Records Window column definition to =Date(GetLabelledText(%_RNOT.TEXT%, "Date:")), i.e. converting the free form text to a date field. That seems to cope well with the scenario of different notes having differently formatted dates so they sort correctly.
Re: Source Records Window, Chronological Date Sorting
Posted: 23 Apr 2022 09:53
by tatewise
Mark, that problem was resolved by converting Text to a Date and FH then sorted accordingly.
This problem is different. FH already knows the metafield is a Date as it only allows Date Qualifiers like :YEAR, :ABBREV, etc.
The problem is that FH does NOT sort the column as a Date even though it knows it is a Date.
So =Date(%SOUR.~DT-EVENT_DATE%) doesn't help (I tried it) but I had an idea and tried converting the Date to Text and back again
=Date( Text (%SOUR.~DT-DATE% ) ) and that seems to work

Re: Source Records Window, Chronological Date Sorting
Posted: 23 Apr 2022 16:42
by Chrisv
The wise owl comes through again!
Thank you Mike!
Now, in layman's terms, why did this happen? And not just to me, but to you also??
Re: Source Records Window, Chronological Date Sorting
Posted: 23 Apr 2022 16:48
by tatewise
My solution is a workaround that just happens to work. It should not be necessary to use that trick.
The problem you reported to CP is still a fault that needs to be corrected, and I hope they agree.
Re: Source Records Window, Chronological Date Sorting
Posted: 23 Apr 2022 17:16
by Mark1834
In layman's terms, it appears to be an internal communication error in FH - the template definition did not tell the records window that this field should be a date, so it was sorted in default alphabetical order. A lot of bugs in complex applications such as FH arise from incorrect internal communication.
Re: Source Records Window, Chronological Date Sorting
Posted: 23 Apr 2022 18:02
by tatewise
Mark, that is what is so odd. The Records Window column Expression does know it is a Date and allows the Date Qualifiers.
Also, the column displays the Date using the Tools > Preferences > General tab Preferred Date Formats.
It is only the sorting process that has the 'incorrect internal communication' you describe.