Jump to content
We've recently updated our Privacy Statement, available here ×

  • gregd

    Jaspersoft OLAP is a powerful multi-dimensional analysis tool. OLAP views can be created and accessed directly from JasperReports Server from the Ad-Hoc designer. That method allows a business analyst to gain insight into their data by slicing, dicing and filtering the data however they want.

    There is another way to unlock the power of your OLAP data, via iReport. iReport can consume multi-dimensional data served up by JasperReports Server by means of MDX through the XML/A interface built into the server. This document will guide a user into creating a report from iReport using the OLAP tables. The benefit of using iReport is the ability to use the built in chart types, the drill-through functionality and others. What you loose is the automatic drill down to the data.

    Why would you want to do this? OLAP is typically used for two reasons:

    • You have a very large dataset
    • The SQL queries you're writing are getting far too complicated

    Jaspersoft OLAP solves these two inhibitors by providing smart aggregations and queries not in SQL but in MDX, which is easier to use than SQL for analysis.

    Connections

    Server

    You'll need to expose an XML/A connection on the server. This is explained in Section 3.5 of the OLAP user guide. Essentially you need to create a new Mondrian XML/A Source connection.

    For the purposes of this example, I'll be using the Foodmart XML/A definition, typically located here on the server: Xmla-server.png.65615dda678a7da1b505617f84810936.png

    iReport

    To define the XML/A Connection in iReport to your JasperReports Server instance you'll need to define a new XMLA Server connection.
    Conn-type.png.30dad3658546f498f4314a8f4d395ceb.png


    Ireport-xmla.png.19765058feecc2ebc7f59ec0cf995328.png

    Query

    Once you've defined the connection, start a new report and you'll have to write a query. Choose the query language MDX

    • Note: DO NOT use the XMLA-MDX query language..it is deprecated.
    • Note: Do NOT leave the Automatically Retrieve Fields box checked, it will cause problems. There is a bug filed for this, however easy to work around.

    You may now use the Query Designer to write an MDX query. Drag fields from the left into the template in the middle.

    • Note: ALWAYS put your measures in Columns and your Dimensions in Rows like my example below. If you don't you'll likely get errors about Tuples not found.

    Mdx-query.png.a4bb861d38bc15673556e487bb6c014a.pngOnce you're happy with your query, press finish. Back at the Query screen, you'll see Columns and Rows on the right, simply double click on each, then select fields and click "Add Field" to map them. You will have to press Clear between each operation. For Dimensions you'll have to assign a Field Name manually.
    Mdx-query-add-field.png.7c4a29ddca963d55e997972309ea63b9.png
    Make sure to assign a type to your measures, in this case Profit and Store Sales are Type Numeric.

    You should end up with something like this. Note that the preview data screen doesn't work in this screen, only in the Query Designer.Mdx-query-done.png.e22201798b124b8a787e3d221cdf6be3.png

    Report

    Now you can write a report like any other. In this example, I create a graph to show Profit and Sales by Product family. The JRXML is attached here:
    Mdx_report.jrxml

    The MDX query can easily be parametrized, you can create drill-through reports and other compelling BI views just like the rest of the product suite.

    Final_product.png.6db09681771c6a116b00550c28cede72.png

    Sub Datasets

    Sub datasets with OLAP are a bit different, you will need to set a parameter called $P{MONDRIAN_CONNECTION} and map to MONDRIAN_CONNECTION - this is similar to REPORT_CONNECTION when you're using JDBC. You can set to use an empty datasource. This will allow you to use the table element, etc.

    Notes

    • Delete fields manually from the field list of the report to remove from the Query editor
    • All fields are automatically mapped as strings, change the Java type in the field list

    See also...

     


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...