[Mondrian] Parameterized Mondrian Queries in PRD

Thomas Morgner mondrian at sherito.org
Wed Jul 21 05:53:12 EDT 2010

String parameters are passed into Mondrian without any postprocessing
by the reporting engine (if the parameter is a java.lang.String,
otherwise we will throw a very visible exception).

You are using a StrToMember which probably does not like the
"{..}" syntax of the sets. Try a StrToSet instead, if you intend
to pass a set.

You can also skip the parameter function and use the classical
${...} parametrization syntax (PRD 3.6 or newer), which performs
a simple replacement on the MDX string. To prevent code injections
you can specify a subformat along with those parameters:

${param} will include the parameter without any modification.

${param,string} will quote the parameter value as MDX string
(slap double quotes around it and escape all inner double quote

${param,formattype,formatstyle} will treat the parameter
as a message format request, so that you can format numbers, dates
and so on properly.

For the grammar of formattype and formatstyle have a look at

On 20.07.10 15:18, waw at 1783.com wrote:
> After looking through Julian's Jira note and looking through MDX notes a
> bit more, I am wondering if the Parameter function is working in PRD. I
> have created a parameter query that creates a member string : {[Client
> Location].[Clients].[CLIENT1]}. The string is part of the PRD MDX Query
> like the following
> select strToMember(Parameter("SetofClients", STRING, "[Client
> Location].[Clients].[All Clients]"))) ON COLUMNS,
> Crossjoin(Hierarchize({[Monthly Period].[2010]}), {[Measures].[Count of
> Employees], [Measures].[Count of Declined], [Measures].[Count No
> Record], [Measures].[Count Requested But No Vaccination Record],
> [Measures].[Count Vaccinated], [Measures].[Count Vaccinated Elsewhere],
> [Measures].[% Vaccinated], [Measures].[% Declined], [Measures].[% No
> Record]}) ON ROWS
> from [Monthly Influenza Summary]
> The query works fine when not parameterized. So, looking at Jira and the
> forums, I am wondering if I am chasing ghosts. The Advanced OLAP option
> in PRD is not well documented, so I am not sure how to build a
> completely dynamic MDX query in PRD. Any thoughts or direction is
> greatly appreciated.
> BR/Bill W.
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian

More information about the Mondrian mailing list