[Mondrian] Mondrian API: Adding a condition to a Query object

Julian Hyde jhyde at pentaho.com
Mon Jul 27 16:47:01 EDT 2009


Sure. (By 'condition' I take it you mean adding a member to the slicer --
not really a condition in the same sense as SQL's WHERE clause.) You can
call Query.setSlicerAxis() to change the slicer expression.

It should work, but Mondrian's query model was not designed to be
well-behaved. If you're doing a lot of work in this area, better to use
olap4j, where the query model is one of the explicit goals.

Juilan 

> -----Original Message-----
> From: mondrian-bounces at pentaho.org 
> [mailto:mondrian-bounces at pentaho.org] On Behalf Of Pedro Alves
> Sent: Friday, July 24, 2009 9:32 AM
> To: Mondrian developer mailing list
> Subject: [Mondrian] Mondrian API: Adding a condition to a Query object
> 
> Hey there.
> 
> 
> Is it possible to add conditions to the Query object after the query 
> string has been parsed?
> 
> eg:
> 
> String query = "select NON EMPTY {[Measures].[Quantity]} ON COLUMNS, 
> NON EMPTY  [Product].Children ON ROWS from [SteelWheelsSales] where 
> [Markets].[All Markets].[EMEA]";
> 
> Query mdxQuery = connection.parseQuery(query);
> 
> // Add an extra condition: [Date].[2006]
> 
> 
> // And evaluate it
> RolapResult result = (RolapResult) connection.execute(mdxQuery);
> 
> 
> 
> Tips appreciated, thanks
> 
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
> 
> 
> 





More information about the Mondrian mailing list