Foswiki on GitHub is open for business! Next release meeting: Monday September 29, 1300Z

Item8700: Sorting mixed data types gives unexpected results

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Normal Closed Extension TablePlugin  
Test case:

DatesSorted ascending
18-Dec-2001
19-Dec-2001 - 23:59
20 Dec 2001 - 23:59
21 Dec 2001
2001-12-22T23:59:59+01:00
2001-12-23T23:59Z
2001-12-24T
2001-12-25T23:59:59
2001.12.26.23.59.59
2001/12/27 23:59:59
2001/12/28 23:59
2001-12-29 - 23:59
2001.12.30.23.59
2001-12-31 23:59
2009-1
2009-1-12
2009

This is because 2009 is considered a number, not a date.

We also have problems sorting empty cells:

number of thingsSorted ascending
 
-1.1 thingies
1 thingy
2 thingies
2.0 thingies
9.99 thingies
10.1 thingies
20 thingies

and mixed numbers and text:

mostly numbersSorted ascending
 
-1
0
1
3
ls -al

This is because the code now assumes a column type to sort on. If a column type is numbers, an empty cell invalidates the column type and further processing is stopped and sorted is done with column type of UNDEFINED.

I have removed the column type concept to just sort on the value, whether it is text, a number, empty or a date.

If you like to test this on your installation, attached is the trunk version of the plugin that - should - work on Foswiki 1.0.9.

-- ArthurClemens - 13 Mar 2010

I tried the attached version; it's a nice solution to sort mixed type columns, but I don't know if sorting of mixed number-and-date columns will ever be satisfactory because common values like '2009' and '2001.12' are ambiguous and because there's no expectation for how numbers and dates order.

-- MegCrocker - 16 Mar 2010
 

ItemTemplate edit

Summary Sorting mixed data types gives unexpected results
ReportedBy ArthurClemens
Codebase trunk
SVN Range
AppliesTo Extension
Component TablePlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins Foswikirev:6734
TargetRelease minor
ReleasedIn 1.1.0
Topic attachments
I Attachment Action Size Date Who Comment
TablePlugin.zipzip TablePlugin.zip manage 27.1 K 13 Mar 2010 - 16:20 ArthurClemens TablePlugin version 1.122
Topic revision: r4 - 04 Oct 2010, KennethLavrsen
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License