views:

24

answers:

2

Hello,

I am building a Report in MS Visual Studio which gets its data from a cube. This has amongst others a dimension called Player. I want to hand over a parameter 'Name' and receive the number of games the player has played. But I do not get the parameter integrated in the MDX-query I use. I had defined the parameter and in the query, I tried many different things, e.g.

Select 
strtomember('@Name')
on 1,
[Measures].[Match Count]
on 0
From [Kicker Manager Data Warehouse]

and instead of strtomember('@Name') for ex.

[Dimension Player].[@Name]

but nothing works. Would appreciate any help.

A: 

MDX does not support parameters like SQL stored procedures do.

You could look at using the SQL command OPENROWSET which allows a SQL proc to execute some MDX and return the results in a normal (2D) recordset. The MDX would then be a string that you could format how you like in the calling code or in the proc.

Or look at executing MDX using ADOMD from Visual Studio (or am I a bit out of date there?). Again, you'd pass it a string.

Magnus Smith
+1  A: 

The correct syntax is strtomember(@Name).

In the query designer, I had to define the parameter once again (dialogue "Query Parameters").

Jan-Frederik Carl