If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

how to dislay conditionally item in cognos

Started by div_1234, 22 Aug 2011 12:23:24 PM

Previous topic - Next topic

div_1234

hi

i want to display 'P' OR 'F' in one of the field.ex, if *quantity = 1 then 'P' else'F'
how can i displayit  in measure .i created variable but its nt working .


any help?

Lynn

Did you create a data item with your expression? When you say "display it in measure" are you referring to a crosstab? I don't understand what you tried that isn't working.

div_1234

i have one filed on sp whose value is 1/0 in sp,but i want to display if 1 then 'P' else 'F'in report studio.

and this all comes from 1 column

for ex. if val = 1 them min,
               val 2 then max,
              val 3 then 1/0 as column





now this column i just drag into crosstab report ,but  i am not able to chnage 'p/f'

thanks

MFGF

Are you trying to use this in the row/column headings of your crosstab or in the measure cells? If it's the former, just add a query calculation and code an expression similar to this:

if ([your quantity item] = 1) then ('P') else ('F')

This will not be valid for the cells though.  The cells of a crosstab can only display aggregated numeric items, not text.

Regards,

MF.
Meep!

div_1234

hi
its in measure,i dont know  how to do in that

MFGF

Quote from: div_1234 on 24 Aug 2011 01:03:51 PM
hi
its in measure,i dont know  how to do in that

You can't. The cells of a crosstab can only display aggregated numeric items, not text.

Regards,

MF.
Meep!

Lynn

You can't use a non-numeric item as a measure in a crosstab, but you can use a layout calculation to do what you have described:


  • Drag the quantity item in as the measure for the crosstab
  • Unlock the report and drag a layout calculation from the tool box next to the <#1234#>
  • Create the layout calculation similar to the below. Using null in the else portion will preserve a blank where there is no result returned at all (vs. a value other than 1).
  • Click on the <#1234#> and set the box type property to none
  • Run and enjoy



case [Query1].[YourQuantityItem]
when 1 then 'P' 
when 0 then 'F'
else ''
end



div_1234

hey Lynn,

Thanks its working fine for simple data,but my data is coming from column which has case statement in SP,i dont know how to use it in a expression.Any Idea?

Lynn

I don't understand the problem. A query item sourced from a column in a table or a column in a view or a column in a SP is still just a query item that returns something of a particular data type.

The expression within the view or SP wouldn't prevent you from referring to it the same way you would refer to a column in a table.

Did you try it and get an error  or something?

div_1234

the thing is i have 1 column, which comes frm sp as

if val = 1 then 1,
val=2 then 2 as quantity.

Now i am dragging quantity in my report, it display like this in column

1| 2
i m putting case like

if val = 2
then ......
i just  want to do for 2,but everything comes as p/f


Lynn

Sorry, I'm still not following you.

You put the quantity data item into the crosstab as a measure, correct?

Then you unlock the report and drag in a layout calculation, correct?

What is the expression syntax for that layout calculation?

Is the layout calculation expression where the problem is? What do you mean by "i just  want to do for 2,but everything comes as p/f"?

div_1234