Pentaho Reporting Web Viewer

The Pentaho Reporting Web Viewer is a web-based application that allows direct access to Pentaho Reports (*.prpt) saved within content repository of the Pentaho BI Server. It can be decomposed into two sections: the report prompt and the rendered report content. The report prompt leverages the power of Pentaho CDF to dynamically create a collection of input controls for users to change report parameters values for a given report.

The prompting piece of the equation is implemented as part of the Pentaho Common UI project. This JavaScript API allows the developer to build a collection of input components that work together to provide prompts for the parameters defined in a Parameter XML Specification.

Project Location

The CDF-based Pentaho Reporting Web Viewer was introduced in Pentaho Platform Reporting Plugin version 4.5.0 and is included in the BI Server 4.5+.

You can find the source code for the Pentaho Reporting Web Viewer project here:
svn://source.pentaho.org/svnroot/platform-plugins/reporting-plugin/branches/4.5

The client-side JavaScript can be found at:
svn://source.pentaho.org/svnroot/platform-plugins/reporting-plugin/branches/4.5/package-res/reportviewer

Architectural Overview

The Pentaho Reporting Web Viewer is built from the ground up to be extensible. Every part of the Report Viewer from the prompting to report content display can be overridden easily to allow a tight integration or custom behavior where desired.

From a high level the Reporting Web Viewer relies on a few different pieces:

  • Pentaho Prompting API: Used to create the report prompt
  • JSTextFormatter: java.text.Formatter-compatible GWT module with a clean JavaScript API. Resides in the common Pentaho GWT Widgets project and provides an easy way to convert number and data parameter values to/from the Pentaho Reporting Engine format and the display format the user expects to see.
  • JQuery
  • Dojo (various custom widgets)
  • RequireJS and Asynchronous Module Definitions (AMD) API: http://requirejs.org/docs/whyamd.html

A large majority of the code is pure JavaScript on the client with a small number of Java components on the server reponsible for rendering the report and generating suitable Parameter XML to define the client-side prompt. The entire reporting prompt is generated and rendered on the client side and can be manipulated at every step of the way.

Customizing the Reporting Web Viewer

The core of the Reporting Web Viewer is the pentaho.reporting.Viewer and pentaho.reporting.Prompt objects; Viewer and Prompt from here on out. Prompt is designed to be a Pentaho Reporting-specific Pentaho Prompting implementation to provide the prompt for a report. It is where prompt refreshing (for cascading prompts), session timeout, and Pentaho Reporting prompt parsing is implemented. It contains the Pentaho Prompting pentaho.common.prompting.PromptPanel reference and is responsible for initializing it.

The Viewer handles all interactions with the view: rendering the report as a styled page, updating the page control, providing localization, and providing hooks for report designers to use (window.reportViewer_openUrlInDialog and window.reportViewer_hide).

Custom Prompting Components

For information on how to define your own custom prompting component check out the Pentaho Prompting Project project page for more documentation.

Custom prompt components are registered as external resources in the plugin's plugin.xml. See this file for an example component.

Custom Prompts for individual reports

At this time we do not support embedding custom prompts within individual reports. Any custom components are defined for all reports or can be dynamically added on a per-report basis when the report viewer is loaded for a specific report. This logic can be done in a sample component so enable itself only under certain conditions.