COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: jyothi_ph on 25 Jun 2010 04:27:08 AM

Title: Sorting Issue
Post by: jyothi_ph on 25 Jun 2010 04:27:08 AM
I am facing an issue in my report i have two columns in my report(subject,count) and the subject column is sorted in ascending order it works fine but in some recods(Q.use.order) is in small case which i dont want to sort and want to display that value(Q.use.order) at last.i am attaching the screenshot.

Subject                            Count
Q.TESTORDER                    100
Q.use.order                         67
Q.VEST1.ORDER1                  90
Q.WEST.ORDER                      7

I want the output Like this

Subject                            Count
Q.TESTORDER                    100
Q.VEST1.ORDER1                  90
Q.WEST.ORDER                      7
Q.use.order                         67
Title: Re: Sorting Issue
Post by: blom0344 on 25 Jun 2010 07:25:18 AM
On SQL server with SQL function set enabled:

create dataitem ascii(substring(subject,3,1))

which has range:

65-90 for  A - Z
97-122  for a - z

Ordering by this object gives Upper Cases first and then lower cases
Title: Re: Sorting Issue
Post by: jyothi_ph on 25 Jun 2010 08:13:51 AM
i am getting the following error

The operation "ascii" is invalid for the datatype "varchar".
Title: Re: Sorting Issue
Post by: blom0344 on 26 Jun 2010 02:51:55 PM
try casting the substring(subject,3,1) part to char(1) before applying the ascii function
Title: Re: Sorting Issue
Post by: jyothi_ph on 28 Jun 2010 02:09:51 AM
Hi still i am not able to resolve the issue the same error is comming can u plz give some more details/steps.

i am using this query ascii(cast(substring(subject,3,1) as char(1)))
Title: Re: Sorting Issue
Post by: blom0344 on 28 Jun 2010 02:28:51 AM
Just tested it on a SQL 2005 database. No problem..
The package will need to have the specific function set enabled (in this case SQL server) for the ascii function to be reckognized
Title: Re: Sorting Issue
Post by: jyothi_ph on 28 Jun 2010 05:11:16 AM
Hi i am able to run from SQl Server but when the ascii function is used in cognos the following error comes

RQP-DEF-0177

An error occurred while performing operation 'sqlPrepareWithOptions' status='-126', UDA-SQL-0460.

Title: Re: Sorting Issue
Post by: blom0344 on 28 Jun 2010 06:32:09 AM
When publishing your package you need to add the SQL server function set, otherwise you cannot use SQL functions from within Cognos..
Title: Re: Sorting Issue
Post by: jyothi_ph on 28 Jun 2010 06:58:31 AM
But i am able to see the ascii function in the Vendor specific functions.

When checking the expression the following error is comming

UDA-QOS-0006Error
UDA-SQL-0460 A general exception has occured during local processing.
UDA-EE-0093 The operation "ascii" is invalid for the data type "character'.

RQP-DEF-0177 An error occurred while performing operation 'sqlPrepareWithOptions' status='-126'.
Title: Re: Sorting Issue
Post by: blom0344 on 28 Jun 2010 11:07:32 AM
The  error refers to 'local processing'. There must be something with the query/package that disables the execution on the database.

What does the SQL look like with the additional dataitem?