Cognos Analytics Active Reports Tutorial

IBM Cognos Analytics Active Report Show and Hide List Columns


In this article, we will learn, how to control the visibility for a list column. We are using active reports. If you are looking for the IBM Cognos Report Studio Solution, you can refer to this article. Before moving ahead, check the following demo about what we will cover in this article.

As per the demo, we have a set for checkbox we need to control the list column visibility based on the checkbox. An end user can select any combination for the checkbox. Based on the user selection we need to display the appropriate columns. We will use the IBM Cognos Analytics version 11.1 for creating our report.
For our report, we are using the following data set. You can use your own data. Data is not important, but the concept is.

CartoonChracters.xlsxLogin to Download

In the above file, we have the following columns

  • First Name
  • Last Name
  • Full Name
  • Date of Birth
  • Gender

We need to provide the option for the end users to select their own set of columns. The following steps are to control the visibility of the Active Report list columns.

Step 1: Create a Report with a Data Source

We can’t start without a report. If you already have an existing report, you can use the same. For us, we started with a blank report. In our blank report, we added a table with a single column and two rows. In the first row, we will add a checkbox. The second row is for our list. The table is only to organize all the elements.

Step 2: Add a Check Box Group

Next, we need to add a “Check Box Group”. Open “Insertable Object” if not open. Click on the Toolbar tab Icon. Search for “Check Box Group” and drag and drop it in the table first row.

Step 3: Add a List

After this, we need to add a List. Add the list and then also add the required columns. As per the reporting requirement, we added “Full Name”, “First Name”, “Last Name”, “Date Of Birth”, and “Gender”.

Step 4: Add the CheckBox Group entries

After adding all the list columns add the checkbox group entries. Add only those columns entries for which you want to control the visibility. We added all the column’s entries. Also, we added extra ID information Why? We can discuss it later.

Step 5: Add Variable

We are almost done with our demo report UI elements. Next, we need a variable to control the List Column visibility. To create a new variable, click on the “Active Report Variable” available on “Insertable Objects”. Then create a new variable. We create a new variable with name “vShowHide” and Data type “String”.

Step 6: Add interactive Behaviour to set a variable value

We have a variable “vShowHide” to control the list columns visibility. To set its value click on the checkbox group and then click on the “Interactive Behavior” icon from the toolbar. In the Interactive behavior dialog under “Behavior on select” add a new set for our “vShowHide” variable. For our first demo, we are using Label. Once done, click on the “Ok” button twice to save all the changes.

Step 7: Define Column Visible Condition

Finally, we need to set “Column Visibility” property for all the required list column. Select the list column for which we need to change the “column visibility”. Open properties panel. In properties under “Interactive Behavior” change the “Column Visibility”. In the dialog “Column Visibility”, we need to first select the third option “Visible based on condition:”. Then we need to define a new condition. Click on the pencil icon it will open a “Column Visibility” condition dialog. In the condition dialog, we can add one or more conditions. For the current example, we only need a single condition. To add a new condition, click on the plus button, it will open a “condition comparison” dialog.  In the “condition comparison” dialog we need to provide a value to test, operator and Active report variable. For example, for the Full Name column, we used “Full Name” as a value, “IN” operator and “vShowHide” as an active report variable. Provide the correct values. Ensure “Drop this condition if the variable is empty” checkbox must be check. What is the use of “Drop this condition if the variable is empty” checkbox? We can discuss it later. For the time being click on the “OK” button to save the changes for all the dialogs and close all the dialogs. Follow the same steps to change the “Column Visibility” for the remaining columns. Save your report and finally test it. If everything is right, you can see the following changes.

Why ID in the CheckBoxes Definition?

As per our first demo, we are using “Label” to set the “vShowHide” variable value. The Label contains column names. We are using the same Label names in our “Column Visibility” conditions. What if during editing the “Column Visibility” conditions we perform a typo? To avoid typos, we would recommend using a numeric column. With numeric columns, we need to perform less typing. It also avoids issues because of typos. To use the ID column, we need to first change the variable values for “vShowHide”. Then we need to use the numbers in the “Column Visibility” conditions.

Why is the use of “Drop this condition if the variable is empty" checkbox?

To explain this, re-edit all the “Column Visibility” columns conditions. Uncheck the “Drop this condition if the variable is empty” checkbox. Once done run the report.
After running, we may see the below image.

Why we are not able to see any columns from the list?

Because when we ran our active report the “vShowHode” variable is empty. If we try to compare any value with empty, it will always return false. Because of this on our report, we are not able to see any columns. Now it’s time to explain the usage of “Drop this condition if the variable is empty” checkbox. If it is checked, it means if the active report variable is empty, ignore the condition. In our first demo, “Drop this condition if the variable is empty” checkbox check. Because of this when the user is not providing any value, we can still see the list columns. 

When to use “Drop this condition if the variable is empty” checkbox?

We would recommend to use it. Or else as you can decide as per the client need.

What is next?

In the above example, we only use a single condition to control the visibility. Next, for you, try to combine more than a single condition.

Leave A Comment

Please login to post your valuable comments.