View source | Discuss this page | Page history | Printable version   

Modules:Analytics Debug


Load OB Analytics Window

The first thing to confirm when a Client has a problem with Analytics Module is that the basic operations work.

As Client Administrator, open the OB Analytics Window. It may take some time to load, as explained in the Documentation.

When the Window is opened, click on the dropdown list available to select a Cube. If there are Cubes defined, and the list is empty, there is already a problem in the instance. At this point the best source of information to find the problems are the logs.

If the Cubes are loaded, further errors may be able to be debugged without looking into the logs.

Debugging Queries with Mondrian

When Mondrian resolves and MDX Query, what is really doing behind the curtain is generating several SQL Queries that are fired against the relational database to retrieve the information.

When there is a problem when retrieving data of a MDX Query, it might be helpful to see the SQL Queries launched as a result of it.

It is possible to do so by adding this lines at the end of the log4j.lcf file.

# Set root logger level to DEBUG and its only appender to MONDRIAN.
log4j.rootLogger=WARN, MONDRIAN
# MONDRIAN is set to be a ConsoleAppender.
# MONDRIAN uses PatternLayout.
log4j.appender.MONDRIAN.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
# Trace MDX and SQL statements
log4j.category.mondrian.mdx=DEBUG, MONDRIAN
log4j.category.mondrian.sql=DEBUG, MONDRIAN

Or if using Openbravo PR19Q1 or newer, edit the following lines in config/log4j2-web.xml:

  <!-- Declare a console appender for Mondrian queries -->
  <Console name="Mondrian" target="SYSTEM_OUT">
    <PatternLayout pattern="%-4r [%t] %-5p %c %x - %m%n"/>
  <Root level="warn">
    <AppenderRef ref="Mondrian"/>
  <Logger name="mondrian.mdx" level="debug"/>
  <Logger name="mondrian.sql" level="debug"/>

Debug Cube Schemas

It is possible to see the XML definition of the Cubes by using the Mondrian mapping service. Using a specific web url:


Replace the host/port/context with the settings relevant for your installation.

The structure of the XML file with the Cube definition is more extensively explained in the Mondrian Documentation.

The MDX file can be split basically in three different parts.


In this part of the XML code is defined how the data is going to be retrieved from the main table.

<View alias="alias1_25">
select * from c_orderline alias1_26 where alias1_26.ad_org_id in ('E443A31992CB4635AFCAEABE7183CE85','0','DC206C91AA6A4897B44DA897936E0EC3','7BABA5FF80494CAFA54DEBD22EC46F01',
and (1 = (select 1 from c_order o where o.issotrx='Y' and alias1_26.c_order_id=o.c_order_id))


In this part of the XML code the Dimensions are defined. For each Dimension it is possible to see the Tables from which the data is retrieved, plus the SQL code that is going to be added to the where clause.

Also the different levels of each Dimension are shown.

<Dimension name="salesOrder-businessPartnerCategory" foreignKey="c_order_id" caption="Sales Order - Business Partner Category">
        <Hierarchy hasAll="true" primaryKey="c_order_id" primaryKeyTable="c_order">
            <Join leftKey="c_bpartner_id" rightKey="c_bpartner_id">
                <Table name="c_order" alias="alias1_37">
alias1_37.ad_org_id in ('E443A31992CB4635AFCAEABE7183CE85','0','DC206C91AA6A4897B44DA897936E0EC3','7BABA5FF80494CAFA54DEBD22EC46F01','BAE22373FEBE4CCCA24517E23F0C8A48',
                <Join leftKey="c_bp_group_id" rightKey="c_bp_group_id" leftAlias="alias1_38" rightAlias="alias1_39">
                    <Table name="c_bpartner" alias="alias1_38">
alias1_38.ad_org_id in ('E443A31992CB4635AFCAEABE7183CE85','0','DC206C91AA6A4897B44DA897936E0EC3','7BABA5FF80494CAFA54DEBD22EC46F01','BAE22373FEBE4CCCA24517E23F0C8A48',
                    <Table name="c_bp_group" alias="alias1_39">
alias1_39.ad_org_id in ('E443A31992CB4635AFCAEABE7183CE85','0','DC206C91AA6A4897B44DA897936E0EC3','7BABA5FF80494CAFA54DEBD22EC46F01','BAE22373FEBE4CCCA24517E23F0C8A48',
            <Level name="businessPartnerCategoryLevel" column="c_bp_group_id" caption="Business Partner Category" table="alias1_39" uniqueMembers="true" ordinalColumn="name">
                    <Annotation name="entity">BusinessPartnerCategory</Annotation>
                <MemberFormatter className="" />
            <Level name="businessPartnerLevel" column="c_bpartner_id" caption="Business Partner" table="alias1_38" uniqueMembers="true" ordinalColumn="name">
                    <Annotation name="entity">BusinessPartner</Annotation>
                <MemberFormatter className="" />


This part of the XML code shows the definition of the Measures. Some of them might have an MDX expression to build them.

<Measure name="invoicedQuantity" column="qtyinvoiced" aggregator="sum">
        <CellFormatter className="$Quantity" />

Debug Queries for Saiku

It is possible to see the saved Saiku Queries in the Analytics Queries Window.

A hint to develop a report that generates a Saiku query is to create the query itself using OB Analytics Window and then save it. Using the XML code of the query generated by Saiku is helpful as a guide to create the query for the report.

Each query can be split in three different parts.


In the header the connection details are set. The name is something that must be unique to the query, an UUID can be used. The connection is the same that OB Analytics Window shows when displaying the Cubes.

<Query name="6793C26C4B504EF9822E16C2C63BAE0FDAF5CA2984604E1A8673D1C659B4057D" type="QM" connection="Openbravo" cube="DPL - P&amp;L - F&amp;B International Group US_A_US Dollar" 
catalog="Openbravo" schema="Openbravo">


For each axis the Dimensions that are going to be shown are specified. Also the members that are going to be included or excluded.

<Axis location="COLUMNS" nonEmpty="true">
                    <Dimension name="accountingDate">
                            <Selection dimension="accountingDate" type="member" node="[accountingDate].[2013]" operator="MEMBER" />
                        <Exclusions />
                    <Dimension name="organization" hierarchizeMode="PRE" hierarchyConsistent="true">
                            <Selection dimension="organization" type="level" node="[organization].[organizationLevel]" operator="MEMBERS" />
                        <Exclusions />


Properties needed by Saiku to understand how to show the data. Always the same.

        <Property name="saiku.ui.render.mode" value="table" />
        <Property name="org.saiku.query.explain" value="true" />
        <Property name="saiku.olap.query.nonempty.columns" value="true" />
        <Property name="saiku.olap.query.nonempty.rows" value="true" />
        <Property name="org.saiku.connection.scenario" value="false" />
        <Property name="saiku.ui.formatter" value="flat" />
        <Property name="saiku.olap.query.automatic_execution" value="true" />
        <Property name="saiku.olap.query.drillthrough" value="true" />
        <Property name="saiku.olap.query.filter" value="true" />
        <Property name="saiku.olap.query.limit" value="true" />
        <Property name="saiku.olap.query.nonempty" value="true" />

Retrieved from ""

This page has been accessed 4,727 times. This page was last modified on 14 November 2018, at 10:10. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.