COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: nancysinghal on 25 Sep 2017 09:35:36 AM

Title: null sorting issue
Post by: nancysinghal on 25 Sep 2017 09:35:36 AM
Hi All,

I have an issue in report, where I have to sort the report on the basis of two columns, A and B, first by A and then by B. The column A can have multiple values of B. Column B datatype is varchar, and it has few blank(empty space) values as well. I want column B values to be sorted in ascending order with blank values at the last.

By default, cognos is taking null values at the top. Cognos version I am using is 10.2.1.

Please suggest.

Regards,
Nancy
Title: Re: null sorting issue
Post by: Invisi on 25 Sep 2017 10:36:38 AM
Nancy, usually you avoid NULL in a data warehouse. What possibilities do you have to have this issue solved at the data warehouse level?
Title: Re: null sorting issue
Post by: nancysinghal on 26 Sep 2017 02:12:58 AM
Thanks Invisi :)

Actually it got sorted by using nvl(trim(column_name),9999999) for sorting. That blank value is as per functional requirement and we cannot avoid it.

Regards,
Nancy
Title: Re: null sorting issue
Post by: Invisi on 26 Sep 2017 04:19:30 AM
nvl should work indeed. I am currently using coalesce to fill NULL values in reports. I am curious though why a NULL value is a functional requirement. What kind of attribute is this field about? And why do they want NULL values instead of some value representing 'missing', 'unknown' or something similar? If you care to share this (offtopic).
Title: Re: null sorting issue
Post by: BigChris on 26 Sep 2017 05:55:22 AM
As Invisi is alluding to, you can certainly keep the NULL in your operational environment (which seems to be a requirement), but replace it with something more meaningful in your BI environment.
Title: Re: null sorting issue
Post by: Invisi on 26 Sep 2017 10:15:03 AM
Quote from: BigChris on 26 Sep 2017 05:55:22 AM
As Invisi is alluding to, you can certainly keep the NULL in your operational environment (which seems to be a requirement), but replace it with something more meaningful in your BI environment.

Good clarification. With giving it some value, I mean in the data warehouse, not in the source application.