[Mondrian] Re: Parameter function: How to use it?

Julian Hyde jhyde at pentaho.com
Tue Sep 29 18:54:29 EDT 2009

Sorry I didn't get to this question. The documentation is definitely not
adequate in this case. (For 99% of MDX functions, we comply with Microsoft's
de facto spec, so the answer is on MSDN... So we're a bit lazy documenting
our MDX functions.)

If a feature isn't documented, the best place to go for doc is the test
suite. Mondrian may be poorly documented, but it's very well tested. In this


The syntax:

   Parameter(<name>, <type>, <default value>, <description>)

* <name> is a string literal
* <type> is either NUMERIC, STRING, or a hierarchy. If the latter, the
parameter's value is a member of that hierarchy.
* <default value> must be specified, and of course it must be of the right
type for the parameter. It can be an expression. We wanted to ensure that
you could run a parameterized query without having to fill out a page of
parameter values.
* <description> is a string literal

If you want to use the same parameter more than once in the query and don't
want to specify type, default value and description more than once, use
ParamRef(<name>) for the second and subsequent occurrences.

To set parameters, use Query.setParameter(String name, Object value) in the
native API, or use PreparedOlapStatement in olap4j (works similar to JDBC's




> -----Original Message-----
> From: mondrian-bounces at pentaho.org 
> [mailto:mondrian-bounces at pentaho.org] On Behalf Of Pedro Alves
> Sent: Tuesday, September 29, 2009 3:27 PM
> To: Mondrian developer mailing list
> Subject: [Mondrian] Re: Parameter function: How to use it?
> I see the answer is no reference available.
> General question: where is the best place to look for this kind of 
> information in the source? Look for the classes where the 
> functions are 
> defined, search for test cases, api, none of the above?
> Thanks in advance
> -pedro
> On 09/09/27 22:56, Pedro Alves wrote:
> >
> >
> > Hello everyone.
> >
> >
> > While using the latest report designer, Thomas mentioned 
> that for mdx we
> > need to use the Parameter function in order to pass 
> parameters to our
> > mdx query, a bit like the sql prepared statements.
> >
> >
> > Where can I find a reference of that function? We were able 
> to use it
> > but a bit by trial and error.
> > http://mondrian.pentaho.org/documentation/mdx.php is not 
> very helpful.
> > Do we need to look at the sources?
> >
> >
> > -pedro
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian

More information about the Mondrian mailing list