[Mondrian] Identification of dimension in row & columns

Julian Hyde jhyde at pentaho.com
Tue Sep 14 12:45:04 EDT 2010


I don't know how to do it using the jpivot API, but if you have access to
the mondrian.olap.Result, you can look at the dimension of the first
member(s) in each row or column.
 
If one of the axes is empty, this method doesn't work; but you probably will
want to treat that as a special case anyway.
 
Result result;
Axis rowsAxis = result.getAxes()[0];
if (rowsAxis.getPositions.size() == 0) return;
Position pos0 = rowsAxis.getPositions().get(0);
for (Member member = pos0) {
    System.out.println(member.getDimension());
}
// similarly for columns axis...
 
If you're using olap4j it's even simpler. See
CellSetMetaData.getAxesMetaData.
<http://www.olap4j.org/api/org/olap4j/CellSetMetaData.html>
http://www.olap4j.org/api/org/olap4j/CellSetMetaData.html
 
Julian
 
 


  _____  

From: mondrian-bounces at pentaho.org [mailto:mondrian-bounces at pentaho.org] On
Behalf Of Nitesh Kumar
Sent: Monday, September 13, 2010 9:30 PM
To: mondrian at pentaho.org
Subject: [Mondrian] Identification of dimension in row & columns


Hi all,

Actually I wanted to make the separate list of dimension of Rows and Columns
. so can any one help me to know that which class/method can give me the
list of dimension on Rows and same for Rows also. like ,

The following code returns you list of total dimension, but I wanted to know
the dimension which are in Rows and Columns.


 com.tonbeller.jpivot.navigator.hierarchy.HierarchyNavigator
hn=navigator.getHierarchyNav();
com.tonbeller.jpivot.olap.model.OlapModel om=hn.getOlapModel();
       com.tonbeller.jpivot.olap.model.Dimension[] dmn= om.getDimensions();

       if(dmn!=null){
           for(int i=0;i<dmn.length;i++){
               if(!dmn[i].isMeasure()){
                   if(!listForOnRows.contains(dmn[i].getLabel())){
                       listForOnRows.add(dmn[i].getLabel());
                   }
                   //out.println(dmn[i].getLabel()+" , ");
               }

           }
}


-- 
Thanks & Regards,
Nitesh Kumar
09811-235-725
011-2598-4625
09654291004
09350-739733


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20100914/a95b348c/attachment.html 


More information about the Mondrian mailing list