Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding Columns based on the values of other coulmns

Status
Not open for further replies.

mbuonocore

Programmer
Jul 7, 2010
9
US
Hi all,

I was wondering if anyone could help me out with the follwoing cognos issue.

I have a list report with multiple (30) columns, but based on the value of one column I would like to hide several other columns when the report is run. Is that possible?

If not does anyone know how to hide certian values in a drop-down prompt?

Thanks!
 
You can set a render variable (boolean) on a column based on certain logic. However THE value of a column would be the issue here. Does the column hold 1 value?

Your prompt is either based on a query or on a fixed list (called collection) In both cases it is possible to influence the data displayed (either through filtering the query or by changing the collection)

Ties Blom

 
Thanks for responding Ties. The column does only hold one of two values. It is either "F" or " ". I am not sure what you mean by render variable. I tried an if-then-else filter but that didnt seem to work. Any other advice would be greatly appreciated.
 
A list report consists of 1 or more columns.
You can set a render variable on a column by defining a boolean expression.

If you select the column in the list, then navigate to properties (list column body) and select the next highest level (list column) you will notice that 'render variable' becomes active.

You can define the variable in condition explorer as a boolean variable (expression that is either true/false or yes/no in Cognos case)

When you add this variable to the properties of the list column you will notice that it is set to 'yes'

Ties Blom

 
Thank you again Ties. I am sorry but I am very new to Cognos. This is only my second week working with the language. I saw where the render vasriable becomes active, but what type of filter would I set up to blank out the other columns values when that column has an F?
 
The render variable is set on a column that should be hidden or not (depending on the boolean expression) There is no filtering involved.
Each column that needs to be hidden can have the render variable activated

Ties Blom

 
Thnaks Ties! Would i then use If(column = 'F') as the boolean expression or is there more to it?
 
A Boolean expression is either true or false. Forget about If then else altogether

[value] = 'F'

is a boolean expression (because it is either true or false)


Ties Blom

 
If I have column A, B, and C and I want to hide the values(F's) in column A if Column C has a value (A's). I would activate render variable on column A and use the boolean expression [Column_C_Value] = 'A'.

Is that correct becuase i am not getting the right results?!?!
 
We are talking about different things here. In your OP you mentioned hiding columns. That is done by using render variables (as I described)

However, you now mention hiding the values (without hiding the column itself I guess)

This is either done by using a CASE expression:

Code:
CASE WHEN
[Column_C_Value] = 'A'
THEN NULL
ELSE
[Column_A_Value]
END

and use this expression in a new dataitem in Column A

or through the use of conditional formatting

(like making sure that both foreground and background are white when the condition is met)

Ties Blom

 
Thnaks Tiee. that espression seems to give me an error though when I run it.

Also, how do you access conditional formatting in Report Studio? Is it only an option in Query Studio?
 
then try:

Code:
CASE WHEN
[Column_C_Value] = 'A'
THEN ('') 
ELSE
[Column_A_Value]
END

Conditional formatting is more extensive in Report Studio, but it also more complicated. You probably need to read up on string variables (as opposed to boolean variables for setting up conditional rendering) and how to apply them to the various objects in Report Studio.
The key is to access the GUI for creating variables (just below the icon for query editor)

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top