COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: sspk on 28 Apr 2010 03:38:50 PM

Title: Dynamic selection of columns
Post by: sspk on 28 Apr 2010 03:38:50 PM
Hi All,
I had problem in multi-selecting the static choices(measures) in a value prompt which i defined for the selection of columns on the prompt page.Here is what i am doing

   1.  Created a report with all the required Columns

   2. Created a prompt page add a value prompt,make it multi-select and check box prompt

   3. In the static choice added the column names that i want to hide

   4. In the Query section from which the list is created added one data item for each column that i want to hide
     
  Expression be:
      if('column name' in ?parameter?) then ([column name]) else ('NO')

   5. Created a Boolean variable for each column with: expression as" [Data Item]='NO' "
     

   6. then all the columns i want to hide/show have been Deleted  and added the data items in their place.

   7. then clicked  on the first column that i want to hide and then selected the Variable associated with that column and clicked on 'YES' choice on it,
      then from properties box clicked  BOX TYPE to be none., repeated it for column header separately.
  8. Repeated Step 10 for all the columns and their headers.
  9. Saved the report and run it.

Now if i select a single column , the report is running fine, but displaying the other columns also with value 'NO' in it.And if i select multiple values it is giving me an error.

Any ideas will help a lot .

Thanks



Title: Re: Dynamic selection of columns
Post by: vinu on 29 Apr 2010 04:46:22 AM
Follow the below simple approach to achieve dynamic column selection.

1. Create a Report with required columns.
2. Create a Value Prompt with Static Choices with column Names. Make it multi Select and check box prompt.
3. Create a Boolean Variable with the below expression for the each column. if you 10 columns then create 10 Boolean variables.
  ParamDisplayValue ('Prompt Parameter Name') contains 'Column Name'
4. Go to Report and Select the column from the ancestor select 'List Column' And select the render variable from the properties pane.

Follow the above 3 and 4 steps for each column.

Let me know if you need any more details.

HTH,
Venu
Title: Re: Dynamic selection of columns
Post by: sspk on 29 Apr 2010 08:01:33 AM
Thanks Venu, that helped me. Even i figured out my procedure i used Null in place of 'NO' in the data item expression