Survey Scale charts with Pentaho Report Designer.

Posted under Open Source, Pentaho, Report Designer, Tutorials

Survey Scale Post PreviewAfter the new release of Pentaho’s Report Designer 3.5 (PRD) I thought I would get stuck into trying out some of the new charting features, of which Survey Scales (and of course Sparklines) interested me the most. Survey Scales are a way of graphically representing values on a predefined scale i.e. survey responses.

Below is a tutorial which I have put together on how to implement Survey Scales within a report using Pentaho’s Report Designer 3.5.

Sample Data

I have decided to create my own data set for this example which is survey responses from athletes. If you would like you can download the Excel workbook and import it into your database of choice.

Here is a quick preview of what the sample data looks like:

ID ATHELETE_NAME TITLE DESCRIPTION VALUE

After importing the data into your database start PRD.

Create a New Connection

Once PRD has started create a new connection to the database which contains the sample data. In this example I have called my connection SurveyResults.

Create a new connection

Make sure to test the new connection before we start building the query.

Test the new connection to the sample data

Build the Query

You will need to build a query to retrieve the survey results, in this example I have called the query GetAllSurveyResults.

Create a new query called GetAllSurveyResults

Make sure to preview the query before we start building our report.

Preview your GetAllSurveyResults query

After clicking OK you should now see a JDBC (SurveyResults) connection, GetAllSurveyResults query and fields under the Data tab.

View the new database connection and query under the data tab

Report Structure

Here is how I will be structuring my report:

  • Page Header
    • Athlete Name (Group)
      • Question Title and Description (Group)
        • Answer (Survey Scale Chart)
      • End of Question Title and Description (Group)
    • End of Athlete Name (Group)
  • Page Footer

As you can see I’m creating a report which will group our survey results by Athlete Name and then by Question Titles and Descriptions to which the Athletes provided Answers to.

Page Header and Footer

By default I have a template which already has a default Page Header and Footer which I have modified for this tutorial.

Page Header and Footer

Creating the Athlete Name group

After you have created your Page Header and Footer the next step is to create the first Group based on the Athlete Name. Right click on the first Groups option under the Structure tab and select the Edit Group option.

Click the Edit Group option

This will open up an Add Group dialog box, click on the ATHLETE_NAME field and then the arrow pointing to the right to add it to the Selected Fields list and click OK.

Edit the groups by adding the ATHLETE_NAME field

Now you need to add the ATHLETE_NAME field into the report. Make sure the Structure tab is active and expand the Groups option and select the Group Header.

Click on the Group Header option under the Structure tab

To make the Group Header visible on the report canvass click on the Attributes tab and uncheck the hide-on-canvass check box.

Uncheck the hide-on-canvass option from the Attributes tab

Now you should be able to see the Group Header on the report canvass.

Group Header in the report canvass active

At the same time under the Structure tab, select the Style tab and scroll down to the page-behavior section and check the pagebreak-after option. You have now made the report create a page break after each ATHLETE_NAME group.

Check the page-break-after option under the page-behaviour section

The next step is to drag and drop the ATHLETE_NAME field from the Data tab onto the Group Header section on the report canvass.

Add the ATHELETE_NAME field to the Group Header section

Creating the Question Title and Description group

To create the Question Title and Description group right click on the Groups section under the Structure tab and click on the Add Group option.

Add a group to the Groups option under the Structure tab

This option will open up an Add Group window. Click on the QUESTION_TITLE and QUESTION_DESCRIPTION fields and then the > button to move these fields to the selected fields list and click OK.

Select the QUESTION_TITLE and QUESTION_DESCRIPTION to the selected=

After clicking OK the Group Header, Details and Footer for the Question Title and Description are automatically shown on the report canvass. Drag and drop the QUESTION_TITLE, QUESTION_DESC fields from the Data tab onto the Group Header section (located under the Group Header section for the Athlete Names).

Drag and drop the Question Title and Description to the Group Header below the Athlete Name

Now you are ready to add in the Survey Scale chart – before you continue make sure that your report is grouping correctly by viewing the report in the Print Preview mode.

Adding in the Survey Scale chart

For your information here is a quick overview of what elements make up a Survey Scale chart.

On the left are the elements which make up a Survey Scale chart (the labels are options which you can set up to be either a set value or an expression under the Attributes tab). On the right are the values I have put in for this tutorial, ANSWERS is a field from our GetAllSurveyResults query. In my data set:

  • The lowest value can be a 0
  • The highest value can be a 10
  • The lower-bound value (the lowest answer Athletes should be answering) is 7
  • The highest-bound value (the highest answer Athletes should be answering is 10)

Elements/options of a survey scale chart

You will need to drag and drop the survey-scale icon (survey-scale) chart object onto the Details section (which sits between the Question Title and Description Group Header and Footer).

After dragging the survey-scale chart object onto the Details section

Double click on the chart object so that a drop down arrow appears and from the available list select the ANSWERS value.

Select the ANSWERS field for the value of the survey-scale

To finish off click on the survey scale chart object then under the Attributes tab find the survey-scale section. As you can see I have static values but you can also create dynamic values as an expression.

Attributes of a survey scale chart object

To see if you have successfully created a report using Survey Scale charts view the report in the Print Preview mode.

A preview of a report including Survey Scale charts

Downloads

Below are links to download the Sample Data, Pentaho Report file or view the tutorial report generated as a PDF.

Filename Type Download Notes
SurveyScaleData.xls Excel Worksheet Download Released 14/01/2010
SurveyScaleExample.prpt Pentaho Report Download Released 14/01/2010
SurveyScaleExample.pdf Adobe Acrobat Download Released 14/01/2010

Enjoy.

Posted by Prashant Raju on Jan 14, 2010 — 3 CommentsShare

3 Comments for “Survey Scale charts with Pentaho Report Designer.”

  1. Posted by Diddy on Jan 15, 2010

    Hi,
    This is a very well made tutorial! I hope I have soon time to sit down and go through it.
    Best regards,
    Diddy

  2. Posted by Prashant Raju on Jan 18, 2010

    @Diddy,

    Thanks! If you need any help don’t hesitate to comment or email me!

    Prashant.

  3. Posted by Diddy on Jan 21, 2010

    Thanks a lot for your offer! I’ll try to find some time this weekend to go through your tutorial!
    Best regards,
    Diddy


Post a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">