Cognos Analytics

 View Only

Cognos 10 JavaScript Prompt API samples in IBM #Cognos Analytics 11

By Samples Team posted Mon May 07, 2018 10:11 AM


In Cognos Business Intelligence 10.2.2, the JavaScript Prompt API provided report authors with a method of customizing prompt interactions in the reports they authored. Fifteen samples were created to demonstrate how to use the Prompt API. After you install the Extended Samples, you will find the Prompt API samples in the Samples_Prompt_API folder.

In Cognos Analytics 11.0.4, embedded JavaScript support changed and improved. Consequently, the 10.2.2 Prompt API samples have been re-written for 11.0.11, using this new approach.

What has changed?
Cognos Business Intelligence 10.2.2 used HTML Items, JavaScript, and the Prompt API. The report is rendered in the Classic Viewer only. IBM Cognos Analytics 11.0.4+ uses Custom Controls (instead of HTML items) and JavaScript modules. The report is rendered in the Interactive Viewer.

Here is a list of the original Prompt API samples that have been updated in 11.0.11:

  • Clear prompt selections
  • Date prompt presets
  • Display all prompt values ignoring user selections
  • Display user selected prompt values
  • Filter country by letter (now called HTML select and HTML slider)
  • Limit numeric prompt selection by database value
  • Limit time between two dates
  • Limit user selection to two items
  • Personal default prompt selections - set selections
  • Personal default prompt selections - use selections
  • Validate prompt values when button pushed
  • Validate type-in postal code values
  • Validate type-in product line code

Coming soon:

  • Date time prompt presets
  • Limit date prompt selection by database value


  • Pass parameter via hidden prompt

Note: You can also successfully open and use all the version 10.2.2 samples in their original form in Cognos Analytics 11. They will be rendered in the Classic Viewer only.

How to install the 11.0.11 JavaScript Samples

The setup instructions and JavaScript sample files are installed (but not configured or imported) with the product in an Easy installation, and if the Samples option is selected in a Custom installation. After product installation, you can find the files here: <Cognos Analytics installation location>\samples\JavaScript\

Please open the file JavaScript_setup_instructions.pdf and follow the steps.

All the JavaScript samples now use a data module as their data source, making them much easier to import.

Related posts:

Please visit our IBM Cognos Analytics channel on YouTube.

#Scriptable report
#Prompt API
#Cognos Analytics
#Prompt API