COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: gatorfe on 24 Jun 2014 03:39:38 PM

Title: Sorting Varchar field in Crosstab Report
Post by: gatorfe on 24 Jun 2014 03:39:38 PM
Hello, we have a crosstab report that has a varchar field.  This sql varchar field contains letters and numbers.  There are 3 values we want to sort on this particular  report.  They are 2205, 316, 316B.  When the field is sorted now on the report it shows 2205, 316, 316B.  The users wants it to be 316, 316B, and 2205.  Since the field that contains the data is a varchar how can we do this?  Thanks in advance for your suggestions!
Title: Re: Sorting Varchar field in Crosstab Report
Post by: rprameshwor on 24 Jun 2014 09:59:59 PM
 316, 316B, and 2205.

Make a new data-item with expression something like :

case
when [field]='316' then '1'
when [field]='316B' then '2'
when [field]='2205' then '3'
end

Then, sort the field by this new data-item.

Check this : http://www-01.ibm.com/support/docview.wss?uid=swg21338917
Title: Re: Sorting Varchar field in Crosstab Report
Post by: raj_aries81 on 26 Jun 2014 05:50:09 AM
Create a new dataitem and then cast it to integer and use it for sorting. For example create a new dataitem something like cast([existing varchar dataitem],int) and then include it in (advanced) sorting

Regards
Raj