[Mondrian] How to explore the dimension object used as a measure?

prakash tiwary prakash.tiwary at gmail.com
Mon Jun 11 02:07:56 EDT 2007


Fabien,
   If you use hierarchy.getDefaultMember(), it will not solve your purpose.
I have done in following ways.
Try this.
    //     Measures are always returned as zeroth dimension
            Dimension dimension = cube.getDimensions()[0];

            mondrianSchema = connection.getSchemaReader()

            //     All Measure names belong to zeroth hierarchy
            RolapMember[] measures = (RolapMember[])
mondrianSchema.getHierarchyRootMembers(dimension.getHierarchies()[0]);

            for(int i = 0 ; i < measures.length ; i++)
            {
              System.out.println((measures[i].getUniqueName()));
            }

Feel free to come back to me.

Thanks & Regards
Prakash
On 6/10/07, Fabien Carrion <fabien.carrion at gmail.com> wrote:
>
> Hi,
>
> I would like to explore the Dimension object when it is used as a measure.
>
> So I do this:
>
> Schema schema = connection.getSchema();
> Cube cubes[] = schema.getCubes();
> for (int n = 0; n < cubes.length; n++) {
>   if (cubes[n].getName().equals(cubeDefaultName)) {
>     cube = cubes[n];
>     break;
>   }
> }
> Dimension dimensions[] = cube.getDimensions();
> for (int n = 0; n < dimensions.length; n++) {
>   Hierarchy hierarchy = dimensions[n].getHierarchy();
>   Member member = hierarchy.getDefaultMember();
>   if (dimensions[n].isMeasures()) {
>     measuresMdx = "";
>     columnsMdx = " select NON EMPTY {" + member.getUniqueName() + "}
> ON columns, ";
>   } else {
>     if (rowsMdx.length() > 0) {
>       rowsMdx.append(", ");
>     }
>   rowsMdx.append(member.getUniqueName());
>   }
> }
> StringBuffer result = new StringBuffer(measuresMdx.length() +
> columnsMdx.length() + rowsMdx.length() + 50);
>
> result.append(measuresMdx).append(columnsMdx).append("NON EMPTY
> {(").append(rowsMdx).append(")} ON rows ").append("from [" +
> cube.getName() + "]");
>
>
> This code just display me one measure. I don't find out where are the
> other measures. How can I display them?
>
> I am using mondrian 2.3.2.8944 in a java program.
>
> Thanks
>
> --
> Fabien Carrion
>
> ()  Campagne du ruban ASCII -- Contre les mails en html
> /\  contre les pieces-jointes Microsoft
> Web: http://fabien.carrion.free.fr/
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20070611/a186569c/attachment.html 


More information about the Mondrian mailing list