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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ReportNet - Display (or hide) columns based on prompt values 2

Status
Not open for further replies.

JGirl

Programmer
Aug 21, 2002
210
0
0
AU
The problem:

I have a simple list report that contains two attribute columns, and a measure column. I want the user to be able to select if they want to hide or show one of the attribute columns in the report via a checkbox list prompt.

For the purpose of keeping this example simple, assume that I have no grouping or filters included in the report.

I have a reasonable idea of how to use Report Studio, however I've found the help extremely useless and lacking the examples that I want (<sarcasm> which is unusual for Cognos documentation, but thats another story...</sarcasm>). I'm guessing that I need to use a variable of some sort, and some sort of conditional formatting (or a conditional block list??), but i'm really lost as to where to start and what order.

Can anyone provide me with a simple set of steps that can help me achieve this?

J
 
Hi JGirl!

This can be done with conditional formatting. The following steps describe how to hide/show one column with a value prompt. You have to adapt the steps to have a check list prompt and to hide/show different columns.

1) First of all create your report in reportstudio. A list report with 3 columns. One column contains a measure and the others are attribute columns.
2) Then make a new prompt page and insert a value prompt. The wizard asks whether you want to create a new or use an existing parameter. Select "Create a new parameter" and choose a name (e.g. Parameter1) --> click finish.
3) Select the property "Static Choices" of the value prompt. Add 2 new choices (e.g. Use: w , Display: with column A; Use: o , Display: without column A).
4) Add a new variable (File -> Variables...) with Type "String" and a name (e.g. "hide"). In the Layout Expression window choose the Parameter Tab and double-click on your parameter (e.g. Parameter1). In the Expression Definition ParamDisplayValue("Parameter1") is displayed. Change this to ParamValue("Parameter1").
Add two values to the variable (e.g "w" for with and "o" for without column - this have to be the same as the "use" in the property "Static Choices" of the value prompt).
5) Click on the list column you want to hide. Then select the property "Conditional Style" and choose your previously added variable (with both values marked).
6) Click on the Condition Explorer and then your variable with the value for hiding the column (e.g. o). Select for the list column the property "Box Type" and change the value to "None" - the list column disappears.
7) Leave the Conditional View by double-clicking the green bar (the explorer-bar changes to green when report studio is in conditional view).
8) Repeat steps 5 and 6 with the list column header - you have to hide the column header seperately.

Hopefully I could help.

kr, Timida




 
Hi,

THanks for your reply - You've cleared up a few of the problems with the application of the conditional formatting that I was having....with the exception of the most important one...When I run the report, even though I have set the prompt to Required = Yes, the prompt page never displays, and so I am never able to choose whether to hide or show the column.

Is there something else I need to set to make the prompt page appear?

J
 
Hi,

Sorry, your are right I forgot the most important thing....

After all the above mentioned steps. Click on the Query Explorer and select your Query (e.g. Query1). Then you see three columns (dimensions, facts and filters). In the column "facts" there are three column items (your three list columns). From the "insertable objects" choose the tab "Toolbox" and insert to this fact column a "data item". A screen "Cube Data Item" opens up (it looks like the expression editor). Click in "available components" on the tab "Parameter" and there double-click your parameter (e.g. Parameter1) --> Click OK. Now the prompt page should be displayed because it is in the query.

kr, timida
 
Legendary! I was so close, but hadnt even thought of embedding the parameter in the query.

Thanks so much for your help. A star for you....

J
 
timida,

that worked ok. What about using conditional block. I've tried using it (there is a sample in Cognos Report Studio manual p.98) but it did not work for me.

Thanks,
Vlad
 
Hello vzak,

I just tried it using a conditional block. And it worked well. The basic steps are the same (see my first post for details).

1) create report with 3 columns
2) make a new prompt page with value prompt (e.g. Parameter1)
3) add to the property "static choices" 2 new choices
4) add a new variable with type "string" and a name (e.g. "hide"). choose your parameter and add two values to the variable
---
5) insert from the toolbox a "conditional block list"
7) insert a new list (toolbox, insertable objects) - not into the conditional block --> select existing query (Query 1).
8) now there should be 2 list items and a conditional block, select one list and delete the column you want to "hide".
9) select the conditional block and change the property "conditional block" to your variable (e.g. hide).
11) select the conditional block, change the property "current block" to "W" (= one value of your variable) and drag the list item with 3 columns into the block
12) change the property "current block" to "O" and and drag the list item with 2 columns into the block
--
13) insert the data item (parameter1) to your query
--> that's it.

Maybe there are additional other ways to work with conditional blocks or to hide/show columns.

kr, timida
 
Timida,
Thanks a lot. ur post was very helpful but i've run into an issue...

When i follow the steps mentioned by you then the 2 columns are hidden from the report page but when i run the report both of these columns are displayed.Not sure how to go about it from here...

Please help me out with this..
Lohita
 
Hello lohita,

I need more information:
Do you use conditional formatting or a conditional block?
Are you prompted for the variable? (if no please insert the parameter in your query - description is above in my post of 13 Jul 05 2:37)

kr, Timida


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top