Pentaho Guide
Pentaho Guide
This document supports Pentaho Business Analytics Suite 5.0 GA and Pentaho Data Integration 5.0 GA,
documentation revision August 28, 2013, copyright © 2013 Pentaho Corporation. No part may be reprinted without
written permission from Pentaho Corporation. All trademarks are the property of their respective owners.
Trademarks
Pentaho (TM) and the Pentaho logo are registered trademarks of Pentaho Corporation. All other trademarks are the
property of their respective owners. Trademarked names may appear throughout this document. Rather than list
the names and entities that own the trademarks or insert a trademark symbol with each mention of the trademarked
name, Pentaho states that it is using the names for editorial purposes only and to the benefit of the trademark
owner, with no intention of infringing upon that trademark.
Contact Us
Global Headquarters Pentaho Corporation
Citadel International, Suite 340
5950 Hazeltine National Drive
Orlando, FL 32822
Phone: +1 407 812-OPEN (6736)
Fax: +1 407 517-4575
http://www.pentaho.com
Sales Inquiries: [email protected]
| TOC | 3
Contents
Introduction................................................................................................................................ 4
Pentaho User Console Styling...................................................................................................5
Location of Customizable Configuration Files.............................................................................................. 5
Add a Logo to the Web Application.............................................................................................................. 6
Change the Background Image.................................................................................................................... 6
Make Custom User Console Themes...........................................................................................................6
Theme System Overview...................................................................................................................6
Create a New Theme.........................................................................................................................7
Set the Default Theme....................................................................................................................... 8
Switch Console Themes.................................................................................................................... 8
Test Your CSS Changes.............................................................................................................................. 8
Localization................................................................................................................................9
BA Server and Thin Client Message Bundles...............................................................................................9
Pentaho User Console and Dashboard Designer Message Bundles................................................ 9
Pentaho Analyzer Localization.........................................................................................................10
Pentaho Interactive Reporting Localization..................................................................................... 11
Geographic Service (pentaho-geo) Localization..............................................................................11
Report Viewer Localization.............................................................................................................. 12
Design Tool Localization.............................................................................................................................12
Use the Kettle Translator............................................................................................................................ 14
Create Design Tool Templates................................................................................................ 16
Create a Dashboard Designer Template.................................................................................................... 16
Create Reporting Templates.......................................................................................................................16
Report Design Wizard Template Design Guidelines........................................................................17
Interactive Reporting Template Design Guidelines..........................................................................17
Dynamic Element Positioning in Templates.....................................................................................18
Template Properties.........................................................................................................................19
Deploying a Template to Report Design Wizard..............................................................................20
Deploying a Template to Interactive Reporting................................................................................20
Setting the Default Interactive Reporting Template......................................................................... 20
Extend Pentaho Analyzer with Custom Visualizations............................................................ 21
Create a Pentaho BA Server Plug-in.......................................................................................................... 21
Custom Visualizations................................................................................................................................ 22
Define the Custom Visualization...................................................................................................... 22
Register the Visualization with Pentaho Visualization API......................................................................... 23
Register the Visualization with Pentaho Analyzer...................................................................................... 24
Register the Created JavaScript Files with Pentaho Analyzer................................................................... 27
Restart the BA Server and Test the Visualization.......................................................................................27
Additional Resources..................................................................................................................................28
| Introduction | 4
Introduction
This section contains a variety of instructions for post-install configuration and maintenance tasks of Pentaho software
and the Pentaho Business Analytics (BA) Server. You can do these tasks in any order that you want, because the
operation of the BA Server is not dependant on doing these tasks in order.
Prerequisites
Before you do any of these tasks, you must have installed the Pentaho software and configured your BA Server.
Expertise
The topics covered in this section are written for IT administrators who know where data is stored, how to connect to it,
details about the computing environment, and how to use the command line interface for Windows or Linux.
Tools
We provide a web application, the User Console, which you use to perform many administration tasks.
Login Credentials
All of the tasks that use the User Console, Administration page, require that you log on to the User Console with the
Pentaho administrator user name and password.
| Pentaho User Console Styling | 5
Product-specific theme settings for Analyzer, Dashboard Designer, and Interactive Reporting
These directories contain style sheets and other theme materials for each .
<themes root-folder="style">
<crystal display-name=”Crystal” system="true">
<file>crystalStyles.css</file>
<file>crystalScripts.js</file>
</crystal>
</themes>
When the Crystal theme is active, the following are added to the HTML page:
This automatic insertion of theme resources makes it possible to change themes without having to edit the main content
HTML documents to include the theme resource's tag individually. The theme system will include any number of
JavaScript and CSS files defined for your theme.
You can add local styles in a similar fashion. The only requirement is that you tell the system what context you need
to load. This is done by adding ?context=myPlugin to the webcontext.js script where myPlugin is the name of your
plug-in or root WAR folder:
<themes root-folder="resources/themes">
<crystal display-name=”Crystal” system="true">
<file>crystalStyles.css</file>
<file>crystalScripts.js</file>
</crystal>
<crystal display-name=”Crystal” system="true">
<file>localCrystalStyles.css</file>
</crystal>
</themes>
Notice that the <themes> node has a root-folder attribute. The value of this attribute is the name of the directory
(relative to the Web application context) where your themes are stored. For WAR-based contexts, this is simply a
directory name inside the WAR. For instance, if your theme is located in the /pentaho.war/accounting/ folder, the
resources would be loaded from /pentaho.war/accounting/resources/themes/.
Plug-in resource loading is different than WAR-based loading in that the plug-in controls how resources are mapped
to the URL. If the theme file from above was located in a plug-in called accounting, then the resources would be
accessed from the following URL: /pentaho/context/accounting/resources/themes/. This kind of resource
mapping is most commonly implemented in BA Server plug-ins through static-path entries:
<static-paths>
<static-path url="/accounting/resources" localFolder="resources"/>
</static-paths>
| Pentaho User Console Styling | 8
You can manually specify a theme for a particular page by including a theme= URL parameter. This will affect only the
requested page. The following will load the debug system and local themes if available:
http://localhost:8080/pentaho/content/myPlugin/index.html?theme=debug
If either the system or local debug theme is not found, the resources for the current active theme loads instead. This is
particularly useful when testing out new themes and for loading debug versions of scripts and styles.
It is also possible to set the session variable pentaho-user-theme to the desired theme name. This is usually done in a
start-up action to have per-user themes in multi-tenancy scenarios.
Localization
This section explains how to localize all Pentaho applications. There are two main paradigms for internationalization:
programs that abstract their integrated textual content to unified message bundles, and programs that store text in
individual properties files inside of JARs.
You can localize the Pentaho User Console, Pentaho Analyzer, and Dashboard Designer by creating locale- and
language-specific message bundles within the Pentaho Web application. Message bundles are dynamically adjusted
according to browser locale, so you can create localized message bundles for every language you want to support, and
let each individual user's system language settings determine which one is loaded.
For brevity's sake, only the default Pentaho User Console files will be explained in detail. The file naming convention is
identical among all message bundles in Pentaho Business Analytics. The following files are located in the /mantle/
messages/ directory:
• mantleMessages.properties: The default message bundle for the Pentaho User Console. In its initial condition, it
is a copy of mantleMessages_en.properties. If you want to change the default language and dialect, copy your
preferred message bundle file over this one.
• mantleMessages_en.properties: The English-language version of the standard message bundle. This is an
identical copy of mantleMessages.properties.
• mantleMessages_fr.properties: The French-language version of the standard message bundle.
• mantleMessages_de.properties: The German-language version of the standard message bundle.
• mantleMessages_supported_languages.properties: Contains a list of localized message bundles and the native
language names they correspond to; this relieves the BA Server of the burden of having to discover them on its own.
A supported_languages.properties file should be created for every message bundle that you intend to localize.
Example of mantleMessages_supported_languages.properties
en=English
de=Deutsch
fr=Français
New files are created in the following format: mantleMessages_xx_YY.properties where xx represents a lowercase
two-letter language code, and YY represents a two-letter locale code, where applicable. So, for instance, U.S. and
British English could have two separate message bundles if you wanted to draw a distinction between the two dialects:
• mantleMessages_en_US.properties
• mantleMessages_en_GB.properties
The language and country codes must be in standard ISO format. You can look up both sets of codes on these pages:
• http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
• http://www.iso.org/iso/country_codes/iso_3166_code_lists.htm
You can edit the default message bundle directly if you need to make surgical changes to the content inside of it. If you
plan to translate it into another language, it makes more sense to copy the file and change the name appropriately, then
translate it line by line. Be sure to update supported_languages.properties with the new country and dialect code and
the native language name that it corresponds to.
Note: All message bundles must be UTF-8 encoded.
cp messages.properties messages_fr.properties
3. Translate the content of the new message bundle into the locale defined in its file name.
4. Edit the messages_supported_languages.properties file in /pentaho-solutions/system/analyzer/
resources/ and add the new locale.
fr=Francais
You now have a translated Analyzer message bundle available in your BA Server.
<Schema measuresCaption="%{foodmart.measures.caption}">
<Dimension name="Store" caption="%{foodmart.dimension.store.caption}"
description="%{foodmart.dimension.store.description}">
<Hierarchy hasAll="true" allMemberName="All Stores"
allMemberCaption="%{foodmart.dimension.store.allmember.caption =All Stores}"
primaryKey="store_id" caption="%{foodmart.hierarchy.store.country.caption}"
description="%{foodmart.hierararchy.store.country.description}>
<Table name="store"/>
<Level name="Store Country" column="store_country"
uniqueMembers="true" caption="%{foodmart.dimension.store.country.caption}"
description="%{foodmart.dimension.store.country.description}"/>
foodmart.measures.caption=Measures
| Localization | 11
foodmart.dimension.store.country.caption=Store Country
foodmart.dimension.store.name.property_type.column=store_type
foodmart.dimension.store.country.member.caption=store_country
foodmart.dimension.store.name.property_type.caption=Store Type
foodmart.dimension.store.name.caption=Store Name
foodmart.dimension.store.state.caption=Store State
foodmart.dimension.store.name.property_manager.caption=Store Manager
foodmart.dimension.store.name.property_storesqft.caption=Store Sq. Ft.
foodmart.dimension.store.allmember.caption=All Stores
foodmart.dimension.store.caption=Store
foodmart.cube.sales.caption=Sales
foodmart.dimension.store.city.caption=Store City
foodmart.cube.sales.measure.unitsales=Unit Sales
mondrian.olap.localePropFile=com.pentaho.messages.MondrianMessages
cp messages.properties messages_fr.properties
3. Translate the content of the new message bundle into the locale defined in its file name.
4. If you want to localize the common-ui interface elements that Interactive Reporting uses, edit the messages.js
files in /pentaho-solutions/system/common-ui/resources/web/dojo/pentaho/common/nls/ and /
pentaho-solutions/system/common-ui/resources/web/dataapi/nls/
You now have a translated Interactive Reporting message bundle available in your BA Server.
3. Extract the default messages.properties file from the pentaho-geo-5.0.0.jar archive in the /pentaho-
solutions/system/pentaho-geo/lib/ directory.
This file contains server-side text for various service status and error messages.
4. Create a localized version of the extracted properties file, then repack it into the same location in the JAR.
The Pentaho Geographic Service now has localized message bundles for the locale you specified in the properties file
names.
cp messages.properties messages_fr.properties
3. Translate the content of the new message bundle into the locale defined in its file name.
4. Inside of the Pentaho Web application, unpack the /WEB-INF/lib/pentaho-reporting-engine-classic-
core- platform-plugin-5.0.jar JAR, then navigate to the /org/pentaho/reporting/platform/
plugin/messages/ directory inside of it.
5. Make a copy of the messages.properties file in this directory; name the copy according to the standard locale
naming scheme defined earlier in this section.
cp messages.properties messages_fr.properties
6. Translate the content of the new message bundle into the locale defined in its file name, and remove all of the
properties that you don't change.
Leaving the unchanged properties in the file will cause duplicate definitions, which cause unnecessary overhead and
difficulty in future translation efforts.
7. Re-pack the JAR.
If the original JAR was not deleted when you unpacked it, you will have to delete it before re-packing.
You now have translated Report Viewer (and Reporting plugin) message bundles available in your BA Server.
mkdir translation
cd translation
| Localization | 13
unzip ./lib/*.jar '*.properties'
Then add that directory to the classpath by editing launcher.properties, and edit or create a localized message bundle
for each properties file you extracted.
The quickest and easiest ways to locate the appropriate JARs, add override directories, and create message bundles is
explained for each design tool in the below sections.
Aggregation Designer
Search for: /aggregation-designer/lib/pentaho-*.jar
Path to launcher.properties: /aggregation-designer/lib/
Modified launcher.properties classpath: classpath=../translations:log4j.xml
Metadata Editor
Search for: /metadata-editor/lib/pentaho-metadata-editor*.jar /metadata-editor/libext/pentaho/pentaho-*.jar
Edit the metadata-editor (.sh or .bat) script, and modify the CLASSPATH variable accordingly:
CLASSPATH=./translations:
Report Designer
Search for: /report-designer/lib/pentaho-reporting-*.jar /report-designer/lib/report-design*.jar
Path to launcher.properties: ./
launcher.properties classpath prefix: classpath=translations:
Schema Workbench
Search for: /schema-workbench/lib/workbench.jar /schema-workbench/lib/mondrian.jar
Edit the workbench (.sh or .bat) script, and locate the following line: CP="${MONDRIAN_HOME}/lib/commons-
collections.jar". Now create a new line directly below it and paste this in:
CP="${CP}${PS}${MONDRIAN_HOME}/translations"
8. Save and close all open files, then start the BA Server.
9. Test your new template and adjust its configuration accordingly.
You now have a custom Dashboard Designer template deployed to your BA Server.
You must copy the template files by hand if you upgrade the BA Server or Dashboard Designer in the future. You may
want to back up your custom templates to a safe location right now just in case you forget to copy them over during a
future upgrade.
Methodology
To create a new RDW template, you must use Report Designer to create a report with certain template-specific
properties enabled. The resultant PRPT file is then deployed to the Report Designer and/or Pentaho Data Integration
template directory.
Requirements
The generated-content-marker attribute in the wizard group is the flag that turns a normal report into a template. This
attribute can only be applied to a band (group header, group footer, details header, details footer, details, or sub-band).
RDW will insert its auto-generated content into the first band with the generated-content-marker set to true. This
applies to the group header, group footer, details header, details footer, and the details bands. In the event there are
more groups defined in the Report Design Wizard than defined in the template, it repeats the last defined group header
and footer in the template.
Formatting Inheritance
Formatting styles are inherited, so any formatting applied to a band will also be applied to the elements used within it.
Formatting is applied in three ways and in the following order:
1. Through the template via band inheritance
2. Through query data where it is defined in Pentaho Metadata
3. As defined by RDW users through the RDW interface
Updating
An RDW template is only a set of initial defaults for a report, so if a template is updated, completed reports that were
based on that template will not be affected; there is no connection between the template and the report once the report
is saved. If you want to update an RDW-based report to reflect template changes, you can edit the report with Report
Design Wizard, make any necessary selections, and re-save it.
Note: Interactive Reporting templates have the opposite behavior because the report links itself to the template;
when an IR template is changed, all reports based on that template will automatically inherit the updated
template.
Methodology
To create a new Interactive Reporting template, you must use Report Designer to create a report with certain template-
specific properties enabled. The resultant PRPT file is then deployed to the IR plugin's template directory.
| Create Design Tool Templates | 18
Requirements
The generated-content-marker attribute in the wizard group is the flag that turns a normal report into a template. This
attribute can only be applied to a band (group header, group footer, details header, details footer, details, or sub-band).
RDW will insert its auto-generated content into the first band with the generated-content-marker set to true. This
applies to the group header, group footer, details header, details footer, and the details bands. In the event there are
more groups defined in the Report Design Wizard than defined in the template, it repeats the last defined group header
and footer in the template.
Formatting Inheritance
Formatting styles are inherited, so any formatting applied to a band will also be applied to the elements used within it.
Formatting is applied in three ways and in the following order:
1. Through the template via band inheritance
2. Through query data where it is defined in Pentaho Metadata
3. As defined by IR users through the Interactive Reporting interface
Updating
A template is not just a set of initial defaults for a report -- it is the basis for that report. So if a template is updated,
completed reports that were based on that template will also change.
Note: Report Design Wizard templates have the opposite behavior; when an RDW template is changed, none
of the reports based on that template will be automatically be updated with those changes. Instead, you will have
to edit each report, apply the new template, and save it.
Percentages
Express the height, width, x position, and y position in percentages.
layout-mode value
canvas Uses the x and y position to place the element in the
band.
block Stacks elements vertically according to the layer order in
a band; width is set to 100%.
inline Stacks elements horizontally according to the layer order
in a band; width is determined by the length of the text in
the field, and wraps within the band.
| Create Design Tool Templates | 19
layout-mode value
row Stacks elements horizontally in one row according to the
layer order in the band.
org.pentaho.reporting.engine.classic.core.layout.fontrenderer.UseMaxCharBounds = true
org.pentaho.reporting.engine.classic.core.modules.
output.table.html.ProportionalColumnWidths = true
Template Properties
The following band properties affect RDW and PIR report templates. Notice that many properties have a different effect
in RDW than in PIR.
template_template_demo=Template Demo
This visualization generates a simple KPI that calculates a minimum, maximum, or avage on a single measure across a
single level.
To extend a custom visualization, perform these actions in order:
1. Create a Pentaho BA Server Plug-in
2. Define the custom visualization
3. Register the visualization with Pentaho Visualization API
4. Register the visualization with Pentaho Analyzer
5. Register the created JavaScript files with Pentaho Analyzer
6. Restart the BA Server and test the visualization
This basic plug-in exposes static files in the resources folder to authenticated users.
Custom Visualizations
Visualizations in Pentaho Analyzer are rendered on the client and are JavaScript based.
You must define a constructor and two key functions in the visualization JavaScript class so that Pentaho Analyzer
can render it properly. The constructor of the visualization class will be passed in an HTML element, which acts as the
parent node of your visualization.
The first function is resize(width,height). The resize function is called every time the visualization renders as a
different size, and allows the visualization to adjust calculations.
The second function is draw(datView, vizOptions). This function is called when rendering the visualization.
The dataView object contains a multi-dimensional result set returned from the server, and the vizOptions object
contains any customized options specified by the user when configuring the visualization.
This basic visualization is the entry point for a more advanced visualization. If you have a Flash component, HTML5,
or SVG visualization library, you can make calls to those elements here and wire them into the innerHTML of the
canvas element.
For a more advanced example, see the Community Chart Components components here:
pentaho-solutions/system/common-ui/resources/web/vizapi/ccc/ccc_wrapper.js
These charts include the heat grid, which is enabled by default in Pentaho Analyzer.
// Utilize the required API for verifying that the VizController has been loaded
before registration
pen.require(["common-ui/vizapi/VizController"], function(){
2. To enclose the required API call, you must define }); at the end of the example.js
All defined values are essential to registering the visualization with Pentaho's Visualization API.
The datareqs subcomponent is especially critical because it defines the data requirements for the visualization, which
are used by Pentaho Analyzer to determine which fields are displayed in the field list.
Use menuOrdinal to specify the location of the visualization in Analyzer’s chart drop-down menu. The default chart
types such as Bar chart start at menuOrdinal 100 and then increment by 100. If you want your visualization to appear
last, use a value greater than 10000.
menuSeparator can be set to true to insert a menu separator before the visualization in the menu.
Use maxValues to increase the available list of maximum plot values. This setting appears in Chart Options > Other
> Domain Limit. If your visualization supports a very large number of values, then you would increase the value so the
data table provided in the draw method includes more rows or columns.
/*
Helpers contain code that knows about the Analyzer specific context. The one
function that's required "generateOptionsFromAnalyzerState" is called so the
visualization can set its own options based on Analyzer's current report.
*/
cv.pentahoVisualizationHelpers['pentaho_sample_KPI'] = {
// Use one of Analyzer's stock placeholder images.
placeholderImageSrc: CONTEXT_PATH
+ 'content/analyzer/images/viz/VERTICAL_BAR.png',
/*
This method allows a visualization to generate visualization specific
options based on Analyzer’s report definition. In the following example,
this visualisation is setting a background color using the same background
color setting in Chart Options. You can figure out the existing chart
options by looking at the report XML by clicking the XML link in Analyzer.
@return a hash object containing the custom state of your visualization.
*/
generateOptionsFromAnalyzerState:function (report) {
return {myBackgroundColor:
report.reportDoc.getChartOption("backgroundColor")};
}
};
/*
LayoutConfig objects manage the interaction between Analyzer's Layout Panel
and the visualization's settings.
*/
// Declare a new class which extends the built-in version from Analyzer.
dojo.declare("SampleConfig", [analyzer.LayoutConfig], {
/**
* @param config The parse Configuration object which serves
* as the model of the Panel.
* @param item The item in the panel which originated the event.
* @param eventName The name of the event (clicked, value, etc).
* @param args A Hash Object containing relevent values (prevVal,
* newVal, etc).
*/
onModelEvent: function(config, item, eventName, args) {
if (eventName == "value") {
// This component has a single argument, so we assume if this event is
// fired it is for the aggregate option.
// This will update the visualization args with the new value for
// aggregate. Also note that when the Analyser report is saved, a
// snapshot of the visualization args will be saved to the report XML.
this.report.visualization.args['aggregate'] =
config.byId('aggregate').value;
In this example, you register a single visualization with Analyzer. The object definition in this JavaScript contains three
main components. The first is the init() method call, this is called when Analyzer initializes the visualization. In this
method, the visualization registers all the necessary handlers for working directly with Analyzer. The two handlers are
the VisualizationHelper object and the LayoutConfig class.
The VisualizationHelper object contains code that is specific to getting your visualization to work in the context of
Analyzer. The key function is to implement generateOptionsFromAnalyzerState, which is used to extract settings
from the Analyzer report XML which can then be used in your own visualization.
The Layout Panel in Analyzer is generated dynamically from the JSON data requirements definition of the visualization,
which was defined in Pentaho Visualization API Registration. For example, notice that the visualization automatically
generated Level, Measure, and Aggregation components based on the rows, measures, and aggregate dataReq items:
In order for your visualization to respond to changes made in the panel, you registered the SampleConfig
configuration manager with Analyzer.
Configuration Managers may extend the following methods:
getConfiguration(): Returns the layout panel definition. Normally, you will not
need to extend this method. The default implementation
in LayoutConfig will create gembars for dataReqs
with dataStructure = column or row and
restore the state by looking at the report XML attributes
and measures. For custom properties such as the
Aggregation dropdown in the above example, the default
| Extend Pentaho Analyzer with Custom Visualizations | 27
implementation will retrieve the current value from either
the generateOptionsFromAnalyzerState function or
from the visualization.args hash map.
updateConfiguration(config): This is called on every report change and allows you
to modify the layout panel state based on the current
configuration. An example use case would be to make all
gembars no longer required if any one of them contained
at least one gem item.
checkAcceptance(source, nodes, silent): Called by Drag and Drop operations in the panel. Return
true if the operation is allowed. Normally you would not
need to extend this method.
onModelEvent(config, item, eventName, All layout panel interactions result in onModelEvent calls
args): to the active Configuration Manager. These events will
typically do one of three things:
• Add, remove or move gems. The base
LayoutConfig will handle these events, update the
report definition, and refresh the report.
• Update report chart properties. When eventName ==
‘value’ and the item.id matches the property defined
in the visualization dataReq, you can manually update
the corresponding chart option in the report XML. The
benefit of saving state in chart options is that it can be
shared across visualizations. You can only set chart
options that were previously supported in Analyzer,
such as background color or label fonts/colors.
• Update visualization args. When eventName ==
‘value’ and the item.id matches the property defined
in the visualization dataReq, you can manually update
the current visualization args. These changes will be
passed back to you in the draw method’s vizOptions
parameter. Anything stored in visualization.args
will be saved with the Analyzer report and is specific to
your visualization only.
<external-resources>
<file context="analyzer">content/example-visualization/resources/example.js</file>
<file context="analyzer">content/example-visualization/resources/
example_analyzer_plugin.js</file>
</external-resources>
Test your visualization in the various browsers that will be used. You can add the XML text in the Report Definition
dialogue box.
More complex examples included in the Pentaho BA Server noted in Define the Custom Visualization on page 22.
These examples go beyond this section, including functionality such as server-side printing, lasso'ing, and selections.
Additional Resources
Providing Javascript Plugins via External Resources:
http://wiki.pentaho.com/display/ServerDoc2x/Providing+Javascript+Plugins+via+External+Resources