constructing a consolidation hierarchy

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • constructing a consolidation hierarchy

      How can I construct a consolidation hierarchy using the Java API?

      I have a database called "sales" and a dimension called "month". Now I want to construct a cons hierarchy like this:

      month ->
      Q1->
      Jan (weight1.0)
      Feb (weight 1.0)
      Mar (weight 1.0)
      Q2->
      Apr ....

      I tried to create the numerical elements (Jan, Feb, Mar, Q1) first by using

      dimension.addElement(<ename>,<etype>)

      Then I created a consolidation with

      dimension.newConsolidation(<jan-element>,<q1-element>,1.0)
      dimension.newConsolidation(<feb-element>,<q1-element>,1.0)
      dimension.newConsolidation(<mar-element>,<q1-element>,1.0)

      When I open the model browser in Excel (or the Eclipse Client) I see only the elements and their types, but no hierarchy! How can I achieve a hierarchy with teh java API? I am using the API 1.5.
    • put all newly created consolidations into an array of consolidations. then use this:

      Source Code

      1. <parent-element>.updateConsolidations(<array-of-consolidations>);

      here a full example:

      Source Code

      1. Element parent, child;
      2. parent = dimension.getElementByName("rootElement");
      3. Consolidation[] consolidations = new Consolidations[3];
      4. child = dim.addElement("1st Element", Element.ELEMENTTYPE_NUMERIC);
      5. consolidations[0] = dim.newConsolidation(child, parent, 1);
      6. child = dim.addElement("2nd Element", Element.ELEMENTTYPE_NUMERIC);
      7. consolidations[1] = dim.newConsolidation(child, parent, 1);
      8. child = dim.addElement("3rd Element", Element.ELEMENTTYPE_NUMERIC);
      9. consolidations[2] = dim.newConsolidation(child, parent, 1);
      10. parent.updateConsolidations(consolidations);