[Mondrian] Parent-child hierachy with no Closure

Eduardo Andrade eduardofandrade at gmail.com
Mon Jul 30 09:38:40 EDT 2007


Hi, i'm having a problem with Mondrian's parent-child hierarchies. In a
parent-child hierachy if we don't specify a Closure Element the results
obtained from Mondrian are different on each version. Tested with Mondrian
2.1.1, 2.2.2 and 2.3.2.8944 (Foodmart.xml - with the Dimension "Employees"
from "HR" Cube).

---------------------------------------------------------------------------------------------------------------------
<Dimension name="Employees" foreignKey="employee_id">
<Hierarchy hasAll="true" allMemberName="All Employees"
primaryKey="employee_id">
<Table name="employee"/>
<Level name="Employee Id" type="Numeric" uniqueMembers="true"
column="employee_id" parentColumn="supervisor_id" nameColumn="full_name"
nullParentValue="0">
<!--
   <Closure parentColumn="supervisor_id" childColumn="employee_id">
      <Table name="employee_closure"/>
   </Closure>
-->
<Property name="Marital Status" column="marital_status"/>
<Property name="Position Title" column="position_title"/>
<Property name="Gender" column="gender"/>
<Property name="Salary" column="salary"/>
<Property name="Education Level" column="education_level"/>
<Property name="Management Role" column="management_role"/>
</Level>
</Hierarchy>
</Dimension>
---------------------------------------------------------------------------------------------------------------------

With this JAVA code :
---------------------------------------------------------------------------------------------------------------------
import mondrian.olap.*;
import java.io.PrintWriter;

public class MondrianCCATest {

    public static void main(String[] args) {
        String jdbcUrl = "jdbc:mysql://localhost:3306/foodmart";
        String jdbcUser = "foodmart";
        String jdbcPass = "foodmart";

        String connectionString = "Provider=mondrian; Locale=pt_PT; Jdbc=" +
jdbcUrl + "; JdbcUser=" + jdbcUser + "; JdbcPassword=" + jdbcPass
                + "; Catalog=file:FoodMart.xml;";

        Connection connection = DriverManager.getConnection(connectionString,
null, false);
        Query query = connection.parseQuery("SELECT {[Measures].[Org
Salary]} on columns," + " {[Employees].[All Employees].[Sheri
Nowmer].children} on rows "
                + "FROM [HR] ");
        Result result = connection.execute(query);
        Position[] positions = result.getAxes()[1].positions;

        try {
            result.print(new PrintWriter("mondrian.html"));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
---------------------------------------------------------------------------------------------------------------------

With Mondrian 2.1.1 I get the list of members correctly :
- Derrick Whelply
- Michael Spence
- Maya Gutierrez
- Roberta Damstra
- Rebecca Kanagaki
- Darren Stanz
- Donna Arnold

But with Mondrian 2.2.2 and 2.3.2.8944 I get an empty result. Should I log a
bug request with this information ?

Thank you for your time.

Best Regards,

-- 
Eduardo Andrade
eduardofandrade at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20070730/0b0ce7dd/attachment.html 


More information about the Mondrian mailing list