Mondrian‎ > ‎

JPivot: mondrianQuery tag

Introduction

If you use JPivot as an interface for Mondrian, you can specify cube configuration in <jp:mondrianQuery> tag and your MDX (Multidimension Expression) query inside the tag.

This wiki article will show you example for that.

Database and Cube Reference

JPivot mondrianQuery tags has 15 attributes you can configured with. The detailed descriptions for each attribute can be found in JPivot's reference page.

Two attributes that are required are :
  • id : Name of the Session Attribute that is created by this tag
  • catalogUri : Path of the Mondrian schema, relative to the application context, e.g. /WEB-INF/FoodMart.xml
And the other two which often occurs if you want to explicitly specify your database connection :
  • jdbcDriver : Java class name of the JDBC driver
  • jdbcUrl : Connection parameters, these are database specific

Example usage for this tag is like below :

<jp:mondrianQuery
    id="query01"
    jdbcDriver="com.mysql.jdbc.Driver"
    jdbcUrl="jdbc:mysql://localhost/foodmart?user=root&password="
    catalogUri="/WEB-INF/queries/FoodMart.xml">

select
  {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} on columns,
  {([Promotion Media].[All Media], [Product].[All Products])} ON rows
from Sales
where ([Time].[1997])

</jp:mondrianQuery>

The blue text is your mondrianQuery tag configuration and the green one is for your MDX query.

In this sample I have a query id query01 in my cube's catalog /WEB-INF/queries/FoodMart.xml. I also specify MySQL configuration in two attributes, a jdbc class (com.mysql.jdbc.Driver) and a connection string (jdbc:mysql://localhost/foodmart?user=root&password=).

We also have an mdx query inside the tag which returned 2 dimensions (Media and Product) in rows and 3 measures (Unit Sales, Store Cost, and Store Sales) in columns from Sales cube.

Try to edit mondrianQuery tag in other jsp sample files bundled with Mondrian distribution and see what effect it has on the files :
  • fourheir.jsp
  • mondrian.jsp
  • colors.jsp
  • arrows.jsp
Comments