[Mondrian] Evaluating an axis expression to used dimension members

Pappyn Bart Bart.Pappyn at vandewiele.com
Thu Aug 25 11:27:54 EDT 2011

I am not using olap4j for the moment, I am still using a mondrian/jpivot combination with direct connection (no xmla).

I have used the mdx parser of Mondrian, derived from it and also written a custom Validator. I also derived from ValidatorImpl, but I had to modify the Mondrian code to make this class public.

This way I am able to dynamically modify MDX with low effort (using the code of Mondrian).

It gets me halfway, since I need some information of how axes will evaluate (which members are needed).

I have tried to use Object value = axisCalc.evaluate(evaluator); to some extend it is successful, but if the query is too complex, the result is too difficult to parse.

For the moment, I see no other way than executing a query in the likes of TestContext.executeAxis(). But this always loads some cell information also…  After the mdx is generated by my piece of code, jpivot kicks in and evaluates the query. I want to prevent that the query is evaluated twice…

From: mondrian-bounces at pentaho.org [mailto:mondrian-bounces at pentaho.org] On Behalf Of Luc Boudreau
Sent: donderdag 25 augustus 2011 15:26
To: Mondrian developer mailing list
Subject: Re: [Mondrian] Evaluating an axis expression to used dimension members


If you want to evaluate a complex axis expression, composed of many levels and MDX functions, I don't know of any other way than to execute the query outright.

However, if you want to evaluate the members of a single level, it is possible to do it without executing an MDX query. If you are using olap4j, you can obtain the list of members of a level by doing Level.getMembers() => List<Member>. There is another way using the Mondrian internal code, but I wouldn't recommend going down that road, as we reserve the right to change it at anytime, thus potentially breaking your application.

Does this help you achieving what you want?

On Thu, Aug 25, 2011 at 4:20 AM, Pappyn Bart <Bart.Pappyn at vandewiele.com<mailto:Bart.Pappyn at vandewiele.com>> wrote:

I am looking for a way to evaluate an axis expression (QueryAxis), to a list of used members.

For example DrilldownLevel({[Store].[All stores]}) should evaluate to a list of store members.

This should be able to happen before running the query (and wasting too much time), since I am writing a mdx preprocessor.


Mondrian mailing list
Mondrian at pentaho.org<mailto:Mondrian at pentaho.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20110825/6788e85f/attachment-0001.html 

More information about the Mondrian mailing list