COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Cognos Talk on 24 Feb 2016 07:13:10 AM

Title: Date sorting show empty/blank date last
Post by: Cognos Talk on 24 Feb 2016 07:13:10 AM
is there any command in cognos to show/sort/order by  empty date last when sorting.
I have seen couple of order and sort commands but cannot manage to make it work on relational source.

Thank you,
Title: Re: Date sorting show empty/blank date last
Post by: BigChris on 24 Feb 2016 08:43:11 AM
Not as such, but you should be able to achieve the same output by creating another field in the query and sorting on that:

if([DateField] is missing) then (2099-12-31) else ([DateField])

or

if([DateField] is missing) then (1900-01-01) else ([DateField])

depending on the sort sequence and whether you want the blanks to be at the top or the bottom of the report.
Title: Re: Date sorting show empty/blank date last
Post by: Cognos Talk on 24 Feb 2016 10:48:19 AM
thank you very much for your reply I will try it now and let you know if it worked. Then I can probably apply conditional formatting and hide that dummy date
Title: Re: Date sorting show empty/blank date last
Post by: BigChris on 25 Feb 2016 01:57:53 AM
Hi, you shouldn't have to bring that column in to the report in order to sort on it, so you wouldn't need to conditionally hide the dummy dates. Click on your table and in the properties pane go to Grouping and Sorting. You should then be able to sort on your new calculated field instead of your original DateField.
Title: Re: Date sorting show empty/blank date last
Post by: Cognos Talk on 25 Feb 2016 06:29:57 AM
Hello,
thank you very much for your suggestion it worked perfectly!!!
Title: Re: Date sorting show empty/blank date last
Post by: BigChris on 25 Feb 2016 06:42:06 AM
Excellent - glad that sorted it for you  ;D
Title: Re: Date sorting show empty/blank date last
Post by: Cognos Talk on 25 Feb 2016 07:01:09 AM
 ;)