Showing posts with label parameter. Show all posts
Showing posts with label parameter. Show all posts

Friday, March 23, 2012

Mining Model Parameter

I have one main mining structure and several mining models that are using the MS Decision Trees algorithm. I have a Reporting Services report that displays the model using a table. I want to set it up so that in the DMX query, I can use a parameter to specify which model to use. That way I just have one report that can reference multiple models. For example I would like to do something like this:

SELECT FLATTENED * FROM [@.model].CONTENT

This doesn't work because I get the error message:

Preparation of DMX query failed.
Error (Data mining): Either the user, user, does not have permission to access the referenced mining model, @.model, or the object does not exist. (Microsoft SQL Server 2005 Analysis Services)

We are running SSAS 2005 SP2. Is there a way to accomplish this?

DMX does not support parameterization of the name of the object being queried.
One of the reasons is that a statement, once prepared, is supposed to have a well defined response schema (column definition) and this cannot be enforced as the value of the parameter changes. For example, the query above would return various results depending on the model being queried.

That aside, you should be able to construct the query by concatenating the DMX fragments with the report parameter, something like
"SELECT FLATTENED * FROM [" + @.model + "].CONTENT"|||

Thanks for your response. I actually tried that and it didn't seem to work. But I did figure out a way to do it. I created a stored procedure that looks like this:

Code Snippet

AS

BEGIN

DECLARE @.OPENQUERY nvarchar(4000), @.TSQL nvarchar(4000), @.LinkedServer nvarchar(4000)

SET @.LinkedServer = 'DMSERVER'

SET @.OPENQUERY = 'SELECT * FROM OPENQUERY('+ @.LinkedServer + ','''

SET @.TSQL = 'SELECT FLATTENED * FROM ['+@.miningModel+'].CONTENT'')'

EXEC (@.OPENQUERY+@.TSQL)

END

The linked server connects to the instance of SSAS 2005 and then I just call the stored procedure from reporting services and pass in the miningModel variable. I had to set it up this way becase OPENQUERY doesn't accept variables for its arguements. I found this article that explains how to get around it. You'll see that I just copied what they did. It might be a little bit of a hack but it works!

Wednesday, March 21, 2012

Minimize (not hide) Parameters

Hello,

I am wondering if RS has the capability to minimize the parameter portion on the top. I see that parameter can be hidden, but I would need the capability to just minimize and if the user needs to change the parameter, they can still click on a button to un-minimize.

Does that make sense?

-Lawrence

If by RS you mean the Report Manager, the toolbar cannot be customized. If you are report-enabling a custom application the ReportViewer controls support customizing the toolbar.

|||

If you are accessing your reports over the web, then if you use URL access to the report server you have the capability of launching a report with the parameters area collapsed. You do this by adding rcStick out tonguearameters=collapsed to the URL query string.

So your URL might look like:

http://localhost/reportserver/?%2freport+directory%2freport+name&rs:Command=Render&rcStick out tonguearameters=collapsed

|||

This is exactly what I was looking for.

Thanks a bunch!

Minimize (not hide) Parameters

Hello,

I am wondering if RS has the capability to minimize the parameter portion on the top. I see that parameter can be hidden, but I would need the capability to just minimize and if the user needs to change the parameter, they can still click on a button to un-minimize.

Does that make sense?

-Lawrence

If by RS you mean the Report Manager, the toolbar cannot be customized. If you are report-enabling a custom application the ReportViewer controls support customizing the toolbar.

|||

If you are accessing your reports over the web, then if you use URL access to the report server you have the capability of launching a report with the parameters area collapsed. You do this by adding rcStick out tonguearameters=collapsed to the URL query string.

So your URL might look like:

http://localhost/reportserver/?%2freport+directory%2freport+name&rs:Command=Render&rcStick out tonguearameters=collapsed

|||

This is exactly what I was looking for.

Thanks a bunch!

Monday, March 12, 2012

Miltivalue Parameters with Max Pool connections

I am trying to write a report with many different records needed (way the database was designed). Client will need multivalue parameter and I have reached max pool connections(can anyone please give me the number).

Normally I would handle this with a stored procedure to create a temp table with the needed information for each section(one row per section), but this will not work with the multivalued parameters(more than one in this report).

Any help on this issue would be appreciated.

Thanks!

Terry

I'm not sure I understand the issue why you are running out of connections, but if all datasets are based on the same data source, you could select the "Use Single Transaction" checkbox on the data source dialog. In that case, all datasets running against that data source will use the same connection. See also: http://msdn2.microsoft.com/en-us/library/ms181198.aspx

-- Robert

|||

I have found the data source, but not the single transaction area. Any help in this area would be appreciated. Will have to solve the multivalue parameter issue later. Idea without multivalue parameter would be a stored procedure to fix this.

Have one other idea with @.t table useage.

Thanks for the information.

Terry

|||

The "Use single transaction" checkbox is only available in report designer. You cannot change this setting once the report is published.

-- Robert

|||

That answered the question. I will have to find it at the start of the development for a new system.

Thanks!

Terry