COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: tamise on 09 Feb 2014 04:34:43 AM

Title: Condition Crosstab
Post by: tamise on 09 Feb 2014 04:34:43 AM
Hello,

i have created a crosstab, but i need to display something on a specific condition.
There is a crosstab that i want to create, I manage to display the value of the column MIN and MAX, but i do not manage to display the column NUM.
For the column NUM, i add on the querie NUM with :
CASE MIN=MAX then MAX else "Difference" END.

But as I have a error message, beacause the value that i am using are not numbers there are varchar.
                    MIN          MAX            NUM
Paris            200          200             200
London        300          500            "Difference"
New Yoork   300          300             300

Is it possible to solve this issue ?
Thanks for your help
Title: Re: Condition Crosstab
Post by: charon on 09 Feb 2014 12:15:22 PM
Hi Tamise,

so, if i understand correctly, you created a data item in your query that has the logic "CASE MIN=MAX then MAX else "Difference" END" implemented, is that correct?
You are right,  the difference of the data typse integer/ char/varchar is an issue.

WhaT you can do: create a boolsche variable with the logic (Min = MAX). if it is correct, the result of the variable is YES, else no.
Second step, open the cells and create a text with the value "Difference".  Third, depending on the result of the variable, render the text or the value.
GL
cheerz

Title: Re: Condition Crosstab
Post by: tamise on 09 Feb 2014 12:49:04 PM
thank you for your reply.

But i do not really understand the second step "open the cells and create a text with the value "Difference".
Indeed, what cells are you talking about ? Is it the column NUM ?

Thanks
Title: Re: Condition Crosstab
Post by: charon on 09 Feb 2014 01:40:01 PM
Exactly... in the menu bar of report studio there is a lock button. clicking on this will enable the possibility to write inside of individual cells of a crosstab. in your case, of the column NUM.
Title: Re: Condition Crosstab
Post by: tamise on 10 Feb 2014 02:45:10 PM
There is always an issue with the type.
i have create on the query NumberMin et NumberMax wich are text not number.
Indeed, I created the variable :

if([ecart par SM].[NumberMin]=[ecart par SM].[NumberMax])
then (1)
else (0)

And i obtain the error OP-ERR-0171 Non-numeric comparisons are not supported 'dataItem
and sometimes
UDA-SQL-0114 The cursor supplied to the operation "APICursor::OpenResult" is inactive. UDA-SQL-0107 A general exception has occurred during the operation "open result". ORA-01722: invalid number

Is there a way to solve this ?
Thanks