Cognos Analytics

JavaScript Samples (Custom Controls) for IBM Cognos Analytics

By Business Solutions posted Mon September 10, 2018 11:20 AM

  
​​

There is a set of samples that demonstrate how to add JavaScript to your reports. Here is a link to the technical documentation.

Starting in IBM Cognos Analytics 11.1.5, the JavaScript samples are part of the Base Samples. You will find them here: Team content > Samples > By feature > Custom controls

You no longer need to install and configure the JavaScript samples yourself!



In IBM Cognos Analytics 11.1.4 and below, the setup instructions and JavaScript sample files are installed (but not configured or imported) with the product during installation. You can find the files here: [Cognos Analytics installation directory]\samples\JavaScript\

Very Important: Please open the file JavaScript_setup_instructions.pdf and follow the steps. If you don't follow the steps, the samples won't work. After completing the steps, you will find the JavaScript samples under Team content > Samples > JavaScript. There is a report named !Table of contents that provides descriptions and links to each sample.

Tip: The tricky part for most customers is the fact that the JavaScript module paths must be configured to match your environment (dispatcher or gateway). This process is described in detail in the file JavaScript_setup_instructions.pdf described above.


List of Cognos Analytics 11.1 JavaScript Samples


  • App bar: This sample report uses JavaScript to create an application bar to switch between a list, charts, and a crosstab.
  • App bar data: This sample report uses JavaScript to create a data-driven application bar.
  • App bar static labels: This sample report uses JavaScript to create an application bar with static labels.
  • Auto refresh: This sample report uses a Custom Control and JavaScript to automatically refresh the report based on a specified time interval (e.g. 15 seconds).
  • Basic button control: This sample report uses a Custom Control and JavaScript to create customizable HTML buttons that filter a report.
  • Basic control: This sample shows how to include a basic JavaScript control.
  • Bootstrap button bar: This sample report uses JavaScript to create a bootstrap button bar to switch between order methods.
  • Cascading prompts with multi-select: This sample report uses a Custom Control and JavaScript to create client-side rendered cascading prompts with multi-select controls. 
  • Cascading prompts with single-select: This sample report uses a Custom Control and JavaScript to create client-side rendered cascading prompts with single-select controls. 
  • Clear prompt selections: This sample report uses JavaScript modules to clear selections from all prompts.
  • Collapse regions: This sample report uses JavaScript to show or hide prompts.
  • Collapse regions and subsections: This sample report uses JavaScript to show or hide prompts, and to show or hide individual prompts within that region.
  • D3 bar chart: This sample report uses JavaScript to generate a D3 bar chart.
  • Data store viewer: This sample report uses JavaScript to access the data store and display rows of data.
  • Date prompt presets: This sample report uses JavaScript modules to provide the user with a set of prompt selection presets based on today's date.
  • Display all prompt values ignoring user selections: This sample report uses JavaScript modules to display all the values in the prompt, whether they are selected or not.
  • Display user selected prompt values: This sample report uses JavaScript modules to display the prompt values selected by the user.
  • Events: This sample report demonstrates how to use JavaScript to respond to events.
  • Google bar chart: This sample report uses JavaScript to generate a Google bar chart.
  • HTML select: This sample report uses JavaScript to create an HTML drop-down list.
  • HTML slider: This sample report uses JavaScript to create an HTML slider to set a minimum value.
  • HTML submit and cancel buttons: This sample report uses a Custom Control and JavaScript to create custom HTML buttons for Submit (renamed from Finish) and Cancel. CSS in the JavaScript creates the button hover color.
  • Indexed prompt: This sample report uses a Custom Control and JavaScript to create a client-side indexed prompt. It creates an alphabetical index based on the first letter of only the Product Types that are available in the data.
  • Info icon: This sample report uses a Custom Control and JavaScript to create an Information icon that users can hover over to display text or an image.
  • Limit numeric prompt selection by database value: This sample report uses a JavaScript page module to restrict a value prompt to the range of values in the database for the Product Number field.
  • Limit time between two dates: This sample report demonstrates preventing the user from selecting a date range greater than 10 days.
  • Limit user selection to two items: This sample report shows how to validate prompt values to stop the user from selecting more than 2 items.
  • List column display: This sample report uses JavaScript to allow the user to select which list columns to display.
  • Loading text: This sample demonstrates loading text with JavaScript.
  • Page module: This sample report demonstrates how to author a page module and access a control in the page module. (This is the base template for a page module.)
  • Personal default prompt selections – set selections: This sample report allows the user to save a set of default prompt selections for use in subsequent reports. The prompt selections are saved to browser cookies.
  • Personal default prompt selections – use selections: This sample report shows how to use the personal default prompt selections.
  • Prompt API buttons: This sample report uses JavaScript to show the results of various method calls.
  • Prompt validation: This sample demonstrates using JavaScript to validate the content of prompt values entered by the user.
  • Validate prompt values when button pushed: This sample report demonstrates how to validate prompt values when a prompt button is clicked.
  • Validate type-in postal code values: This sample report uses a JavaScript page module to validate user input character by character as the user types to ensure that a valid postal code is entered.
  • Validate type-in product line code: This sample report uses a JavaScript page module to validate user input character by character as the user types to ensure that a valid product line code is entered.

Notes. Beginning in IBM Cognos Analytics 11.0.10, all the JavaScript samples now use a data module as their data source, making them much easier to import. You no longer need to install the full Extended Samples in order to use the JavaScript samples.

These samples are improved with each release and are not backward compatible.


JavaScript in Cognos Business Intelligence 10

Cognos Business Intelligence 10.2.2 uses 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.




Related posts:



Types of Samples:
Base Samples | Extended Samples | JavaScript | Themes and Extensions | Audit Reporting | OLAP | Package Based Drill-Through | Legacy | 10.2.2 Cognos Mashup Services (CMS) | Notebooks


Please visit our IBM Business Analytics Support channel on YouTube.



Tags:
#Cognos Analytics
#JavaScript
#reporting
#Scriptable report
#samples​​​​​​​
#prompts
#11.0.11​
#LearnCognosAnalytics
#home
#Notebook
0 comments
338 views

Permalink