Quantcast
Channel: Pentaho – Francesco Corti
Viewing all articles
Browse latest Browse all 39

Developing a two levels smart filter for Pentaho dashboards

$
0
0

After the description of the basic version of the smart filter, in this post is described the development of a two levels smart filter using the Pentaho CDE dashboards of the Pentaho Analytics Platform. The post is developed as a step by step description on how to reach the goal.

In this post I would like to share the development of a more advanced filter, different from the default and well-known drop-down menus, check-boxes, ecc. The goal is to make the developers able to design results more advanced and modern, respect to the awful dashboards that sometimes I see. 😉

The goal

One of the most useful features of the Pentaho suite is that you can develop your own dashboards and analytics with a real framework, ready to use. Usually the dashboards are defined by charts, tables or several other components but often the interaction with them requests the development of filters, menus or configuration components.

In this post, in the same way we developed the first example in a previous post, is shared an example of smart filter based on a mondial database, useful for the purpose of the demo. The goal is to develop a filter on a simple chart that lists the first fifteen languages spoken in every country of the world (in the previous example we talked about continents). The two-levels filter is defined by the Continent level that contains the Countries.

Preparing the environment

All the development has been on the platform described below.

  • Operating System: Linux Ubuntu 14.04.LTS (vanilla installation).
  • Java v1.7.0._65 (installed with ‘sudo apt-get install default-jre’).
  • MySql and Workbench (installed with ‘sudo apt-get install mysql-server mysql-workbench’).
  • Pentaho Analytics Platform v5.2 (tested also on v5.0 and v5.1).

In the version of the Pentaho Analytics Platform I used, I had to update the Community Dashboards Framework (CDF), the Community Data Access (CDA) and the Community Dashboard Editor (CDE) to the latest TRUNK version because of some relevant bugs. This task is easy to develop using the Pentaho Marketplace… very easy to use with a single ‘click and restart’ approach. 😉

Preparing the “mondial” database

Before developing the dashbards, the database should be set. For testing purpose I choose the MONDIAL database from Georg-August-Universität of Göttingen. For further details about its structure take a look to the post here where the database is described.

Presentation of the dashboard

As described before in the post, the dashboard develops a filter on a simple chart that lists the first fifteen languages spoken in every country of the world. I think that a video that shows the interaction with the user is preferable to a boring description. Below the video that shows the final result.

The technical approach

The result described before can be obtained with the same strategy described in the previous post, where we focused on the Community Dashboard Editor (CDE), in particular the Components Layer shown below.

smart_filter 2

More in detail, the result can be obtained working on the components described below:

  • The Popup component with id ‘filterGeoPopupComponent’, hidden in the ‘hiddenPopups’ row of the HTML layer.
  • The Button component with id ‘filterGeoButton’ that shows the popup using the javascript function described below, once is pressed.
function f(e) {
 render_filterGeoPopupComponent.popup($(e.target));
}

Into the Popup component, the Multiple select components with id’filterGeoLevel1Component’ and ‘filterGeoLevel2Component’ are the real filter of the Countries.

In this case, the development is quite advanced because we have to manage the first selection of the Continents that filter the Countries and, later, the query about the languages.

Source code

Last but not least, I would like to share the source code of the dashboard to make everyone able to check the technical details. The zip file you can download here, contains the three files below.

  • smart_filter_2.cda
  • smart_filter_2.cdfde
  • smart_filter_2.wcdf

To try (and use) it, simply upload the files into the repository using the Pentaho Analytics Platform interface (Browse button), and open the wcdf.

Conclusion

In this post is described the development of a smart filter using the Pentaho CDE dashboards of the Pentaho Analytics Platform. The goal is to develop a two-levels filter on a simple chart that lists the first fifteen languages spoken in every Country of the world. The goal is to make the developers able to design dashboards more advanced and modern.

The post Developing a two levels smart filter for Pentaho dashboards appeared first on Francesco Corti.


Viewing all articles
Browse latest Browse all 39

Trending Articles