IBM Cognos 8 Advanced Reporting – Hidden Prompts

In the past, we have introduced techniques around dynamic prompting by utilizing a number of Cognos Report Studio built-in features. Occasionally there are scenarios that will necessitate the need to set a report parameter without prompting the user to select a value. For instance, there may be a case where the report developer needs to pass both the selected year and the previous year to a stored procedure or pass in a calculated prompt value that would be based on previously selected prompt values. While there are a number of solutions for such scenarios, in this article we will focus on a Javascript based technique to provide the necessary functionality.

Development Environment

IBM Cognos 8.4 using Internet Explorer 6.0 or Higher

Note: This technique uses JavaScript against underlying report objects in a Cognos BI report. For this reason, there is no guarantee that this solution will work for other versions of Cognos due to the structural differences within the applications components when compared to the tested version. .

Step by Step Instructions

  1. Launch report studio, select Go Sales(query) package.
  2. When prompted, choose create a new report with a list template.
  3. From the Sales(query) namespace, drag Quantity and Revenue data items from the Sales query object. Add in the Year data item from the Time dimension. Your list report should appear as follows:

  4. Navigate to Page Explorer -> Prompt Pages, drag in a new prompt page.
  5. Drag a value prompt to the prompt page, and set the parameter as “pYear” when prompted to create a new parameter in the prompt wizard     .
  6. Enter “Year” as the name of prompt object (Under properties/Miscellaneous)and click on Finish.

  7. Add in a text item to describe the prompt.
  8. Under the prompt properties, add in static choices values: 2005, 2006, 2007.

  9. Set the data format property to number with zero decimal places.
  10. Drag a text box prompt onto the prompt page. Set the parameter name to “pYearLess” in the wizard and set its object name to “YearLess”.

  11. Your prompt page should now resemble the following:

  12. Delete the default Finish button.
  13. Add a HTML item after the Next prompt button.

  1. Type in the following JavaScript code in the HTML item:

    <button class=”bp” onClick=”setYearPrompts();”>Finish</button>

    <script type=”text/javascript”><!–

    function setYearPrompts()


    var fW = (typeof getFormWarpRequest == “function” ?getFormWarpRequest() : document.forms[“formWarpRequest”]);

    fW._textEditBoxYearLess.value=fW._oLstChoicesYear.value -1;




  2. Navigate to the report page and add in the following filter to the report:

  3. Run report and you will notice that the report is actually filtered by the hidden prompt value (User selected year minus one).

JavaScript is a very powerful technique available to report authors in IBM Cognos Report Studio. However, in many cases the code is tied to the underlying Cognos web page structure, which in return brings in some overhead on maintenance and upgrade oriented activities. For this reason, it is imperative that Javascript is used judiciously during report development.