Wednesday, May 29, 2013

Trick to sort Apex Calendar data based on any Column of choice

At present the Apex Calendar does override the column sort added to the SQL statement by the Date column used.

There is a trick to override this functionality, you need to modify your SQL statement to achieve the same.

select display_column, cast(date_column as timestamp) +  numtodsinterval('0.00' || rownum,'SECOND') date_column, sort_column 
from 
(select display_column, date_column, sort_column 
 from your_table 
 order by sort_column desc)

In the above example the Calendar data will be sorted on sort_column in a descending order.