<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6001.18226" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=007100518-25042009><FONT face="Lucida Sans" color=#000080 
size=2>I meant 
SchemaReader.getLevelMembers(level,boolean).</FONT></SPAN></DIV><BR>
<BLOCKQUOTE 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000080 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> mondrian-bounces@pentaho.org 
  [mailto:mondrian-bounces@pentaho.org] <B>On Behalf Of </B>Wen<BR><B>Sent:</B> 
  Thursday, April 23, 2009 7:10 PM<BR><B>To:</B> 
  mondrian@pentaho.org<BR><B>Subject:</B> [Mondrian] Fwd: How to get all the 
  measures definition in amondrian schema file<BR></FONT><BR></DIV>
  <DIV></DIV>Thank you reply!<BR>I looked up mondrain API and source code, but 
  found that there are no "<SPAN class=530505717-23042009><FONT 
  face="Lucida Sans" color=#000080 size=2>getLevelMembers" this<SPAN 
  style="COLOR: rgb(0,0,0)"> method of</SPAN><BR style="COLOR: rgb(0,0,0)"><SPAN 
  style="COLOR: rgb(0,0,0)">Level.&nbsp; am I using a wrong version of 
  mondrian?<BR><BR>Thank you.<BR></SPAN></FONT></SPAN><BR>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>You want the members of the [Measures] dimension.&nbsp; The [Measures] 
  dimension has one hierarchy, also called [Measures], and one level. All 
  measures (including calculated measures) belong to that level. 
  </FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>SchemaReader schemaReader;</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>Cube cube = find(schemaReader.getCubes(), "Sales");</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>Dimension measuresDimension = schemaReader.getCubeDimensions(cube), 
  "Measures");</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>Level measuresLevel = 
  measuresDimension.getHierarchies()[0].getLevels()[0];</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>boolean includeCalc = true;</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>Member[] measures = measuresLevel.getLevelMembers(measuresLevel, 
  includeCalc);</FONT></SPAN></DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>Cube find(Cube[] cubes, String name) {</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>&nbsp;&nbsp; ...</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>}</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>Dimension find(Dimension[], String name) {</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>&nbsp; ...</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>}</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>Please use the olap4j API if possible. olap4j is the official way to 
  interface with mondrian these days, and things are a lot simpler. 
  </FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>OlapConnection connection;</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>NamedList&lt;Measures&gt; measures =</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>&nbsp; 
  connection.getSchema().getCubes().get("Sales").getMeasures();</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=530505717-23042009></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>olap4j is applying access-control automatically, just like 
  SchemaReader.</FONT></SPAN></DIV>
  <DIV><SPAN class=530505717-23042009></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=530505717-23042009><FONT face="Lucida Sans" color=#000080 
  size=2>Julian<BR><BR></FONT></SPAN></DIV><BR><BR>
  <DIV class=gmail_quote>---------- Forwarded message ----------<BR>From: <B 
  class=gmail_sendername>Wen</B> <SPAN dir=ltr>&lt;<A 
  href="mailto:xwcheng@gmail.com">xwcheng@gmail.com</A>&gt;</SPAN><BR>Date: Thu, 
  Apr 23, 2009 at 10:24 PM<BR>Subject: How to get all the measures definition in 
  a mondrian schema file<BR>To: <A 
  href="mailto:mondrian@pentaho.org">mondrian@pentaho.org</A><BR><BR><BR>Hi 
  all,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I can get all the schema by 
  getSchemaReader(), and then use the cube object to get all the Dimensions 
  definition,<BR>measure is a special dimension, so it should be got too. but 
  how can i get a special measure's name<BR>for example, in foodmart there is a 
  "Unit Sales" measure:<BR><BR>&nbsp;&lt;Measure name="Unit Sales" 
  column="unit_sales" aggregator="sum"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  formatString="Standard"/&gt;<BR><BR>&nbsp;the dimension.getUniqueName() method 
  just return 
"[Measures]"<BR><BR>Thanks.<BR><BR></DIV><BR></BLOCKQUOTE></BODY></HTML>