The interesting Part is it executes Successfully, If I dont try to validate the modified query. Below is the code snippet which i Used to validate the query<div><br></div><div><div><b> try {</b></div><div><b> mdxParsetest.mdxValidator.validateSelect(mdxParsetest.parsedObject);</b></div>
<div><b> } catch (OlapException e) {</b></div><div><b> System.out.println("Execution failed: " + e);</b></div><div><b> }</b></div><div><b><br></b></div><div><b> CellSet cSet = mdxParsetest.statement.executeOlapQuery(mdxParsetest.parsedObject);</b></div>
<br><div class="gmail_quote">On Mon, Jan 3, 2011 at 8:23 PM, Venkatesh U <span dir="ltr"><<a href="mailto:venkatesh20@gmail.com">venkatesh20@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<div> I am trying a olap4j with simple example below. But it is not working</div><div><br></div><div><div><b>String mdxQuery2 = "WITH SET [TimeDimension-CurrentSelection] AS'"</b></div><div><b> + "{[TimeDimension.MonthLevel].[JAN-2010]:[TimeDimension.MonthLevel].[MAR-2010]}'"</b></div>
<div><b> + "SELECT [TimeDimension-CurrentSelection] on 0 "</b></div><div><b> + "FROM [SpendAnalytics]";</b></div><div><b><br></b></div><div><b><br></b></div><div><b> mdxParsetest.parsedObject = mdxParsetest.parser.parseSelect(mdxQuery2);</b></div>
</div><div><b><br></b></div><div><b><div> List<ParseTreeNode> wthSet = mdxParsetest.parsedObject.getWithList();</div><div><br></div><div> List<ParseTreeNode> DOWCurSel = new ArrayList<ParseTreeNode>();</div>
<div><br></div><div> DOWCurSel.add(new IdentifierNode(</div><div> new IdentifierNode.NameSegment("DayOfWeek"),</div><div> new IdentifierNode.NameSegment("MON")));</div>
<div><br></div><div> DOWCurSel.add(new IdentifierNode(</div><div> new IdentifierNode.NameSegment("DayOfWeek"),</div><div> new IdentifierNode.NameSegment("TUE")));</div>
<div><br></div><div> CallNode AggOfDow = new CallNode(null, "Aggregate", Syntax.Function, new CallNode(null, null, Syntax.Braces, DOWCurSel));</div><div> IdentifierNode AggDowSel = new IdentifierNode(new IdentifierNode.NameSegment("DayOfWeek"), new IdentifierNode.NameSegment("CurrentSelection"));</div>
<div><br></div><div> <span style="font-weight:normal"><b><div style="display:inline !important">WithMemberNode DayOfweekCurrentSelection = new WithMemberNode(null, AggDowSel, AggOfDow, null);</div>
</b></span></div><div><br></div><div> wthSet.add(0, DayOfweekCurrentSelection);</div><div><br></div><div><i><font color="#660000">The generated MDX query is </font></i></div><div><i><font color="#660000"><br>
</font></i></div><div><div>WITH</div><div>MEMBER [DayOfWeek].[CurrentSelection] AS 'Aggregate({[DayOfWeek].[MON], [DayOfWeek].[TUE]})'</div><div>SET [TimeDimension-CurrentSelection] AS '{([TimeDimension.MonthLevel].[JAN-2010] : [TimeDimension.MonthLevel].[MAR-2010])}'</div>
<div>SELECT</div><div>[TimeDimension-CurrentSelection] ON COLUMNS</div><div>FROM [SpendAnalytics]</div><div style="font-style:italic;color:rgb(102, 0, 0)"><br></div><div style="font-style:italic;color:rgb(102, 0, 0)">
But i get the below error when i try to validate and execute the above SelectNode, below is the stack trace</div></div><div style="font-style:italic;color:rgb(102, 0, 0)"><br></div><div><div>Exception in thread "main" java.lang.UnsupportedOperationException: need to implement class mondrian.mdx.NamedSetExpr</div>
<div> at mondrian.olap.Util.needToImplement(Util.java:1133)</div><div> at mondrian.olap4j.MondrianOlap4jConnection$MondrianToOlap4jNodeConverter.toOlap4j(MondrianOlap4jConnection.java:755)</div><div> at mondrian.olap4j.MondrianOlap4jConnection$MondrianToOlap4jNodeConverter.toOlap4j(MondrianOlap4jConnection.java:687)</div>
<div> at mondrian.olap4j.MondrianOlap4jConnection$MondrianToOlap4jNodeConverter.toOlap4j(MondrianOlap4jConnection.java:785)</div><div> at mondrian.olap4j.MondrianOlap4jConnection$MondrianToOlap4jNodeConverter.toOlap4j(MondrianOlap4jConnection.java:673)</div>
<div> at mondrian.olap4j.MondrianOlap4jConnection.toOlap4j(MondrianOlap4jConnection.java:516)</div><div> at mondrian.olap4j.MondrianOlap4jConnection$MondrianOlap4jMdxValidator.validateSelect(MondrianOlap4jConnection.java:655)</div>
<div> at com.mdxparsetest.venki.MdxParseTest.main(MdxParseTest.java:123)</div></div><div><font color="#660000"><i><br></i></font></div><div><font color="#660000"><i>Could anyone please help to resolve this?</i></font></div>
<div><font color="#660000"><i><br></i></font></div><div><font color="#660000"><i>Thanks in advance</i></font></div><div><font color="#660000"><i><br>
</i></font></div><div><font color="#660000"><i>Venkatesh</i></font></div><div><font color="#660000"><i><br></i></font></div><div><font color="#660000"><i><br>
</i></font></div></b></div>
</blockquote></div><br></div>