How to set the DB as parameter in SSRS? - reporting-services

I'm using ReportBuilder 3.0 for creating report in reporting services 2008. I have many DB with the same tables (different data) and I created a report that can be applied to all these DB. I want to add a parameter to choose the database so the user can choose the DB from which getting the data.
I created a parameter (named "DB") with the name of the DBs as avilable values, but I can't use the parameter in the queries as I was expected:
SELECT *
FROM #DB.[dbo].[TableName]
That query (used in a dataset) doesn't work.
There's a way to set the DB as a parameter?

In TSQL, you would use dynamic sql to do this (EXEC(#CMD)). I doubt report builder will allow you to do this. There are security risks to this.

Related

How to pass parameters to Pentaho Report (.prpt) so that sql query can run dynamically to make report at runtime

I have a static Pentaho Report(.prpt) on my pentaho server.I am trying to find the way to pass paramater to my pentaho report and refresh(update) the report using pentaho scheduler.I am able to run the sql query each time the scheduler runs.
But I want to pass parameter(user data to be used in mysql query) dynamically so that I am able to generate user specific reports for all users using same prpt file on my server.
How can that be achieved? Can anyone explain with an example regarding the dynamic query scripting in Pentaho Report Designer as there is no material which can be found for the same.
I am using Pentaho Report Designer and Server(8.1).
You must first create a parameter on the report (under the Data Tab, choose Parameters and right-click to create a new parameter). Those parameters can be passed from the URL, or set via a selector/dropdown.
Then you can use the parameter by entering it into the query with a syntax such as shown below:
select * from sales where customer = '$(customerParam)'

Using User!UserID in SSRS to access data in SSAS Cube

I am running SQL 2012 and I have a SSAS multidimensional cube that holds measures for our retail business. I have created an SSRS report that pulls the data from the SSAS cube. I want the user to be able to run the report and only pass the users specific store revenue, customer count, ect, on the SSRS report that they are viewing.
I have created a parameter from the cube. Under the report parameter that was created from the cube I put in under default values, specific values, this expression for the value ="[DimUserTable].[Username].[UserID].&[" + User!UserID + "]", the report will not run. It gives the error;
For more information about this error navigate to the report server on the local server machine, or enable remote errors
Query execution failed for dataset 'Revenue'. (rsErrorExecutingCommand)
Does anyone have any idea how I can accomplish getting only the users store information to show on the report they are viewing?
You only need to pass the user id to the parameter.. your query should take care of the filtering using the parameter. Something like
where [DimUserTable].[Username] = #userid
I would use the following as the default value for the userid parameter
=User!UserID.Substring(User!UserID.LastIndexOf("\")+1)
Of course, this depends on what your cube holds for userid value. If it does NOT include the domain or machine name.. use the above.. else just use =user!userid

how to write dyanamic select query statement with where clause in lovs management of SPAGOBI server

I need to write simple select statement with where clause dynamically in List of values(Lovs management) of SpagoBI server.
And I want to know how to set profile Attribute in SpagoBI server.
Can any one help me..?
Create dataSource in spagoBi first then create the query in the dataset.In the dataset you can set the dynamic feature with the parameter see help in dataset for it then you can preview the dataset with preview option in it. You can use this dataset in any cockpit or document build in server.

SSRS Dynamic data source is not working

I have a dynamic data source in my SSRS Report. It will get its server name from a parameter defined in the report. I defined my dynamic data source connection string as
="Data Source="+Parameters!HostServer.Value+";Initial Catalog=DBName"
When I am trying to define a data set using this data source, I am not able to extract the fields out of the query used in the data set. The error I am facing is that "Could not update a list of fields for the query. Verify that you can connect to the data source and the query syntax is correct..."
If I use the same query against my server in SSMS editor, I am getting expected output. And the parameter has already a default value which I suppose the report will use while testing connection.
If anyone know how to resolve this connectivity issue with dynamic data sources, please help.
You should create another temporarly datasource where you need to set connection to one of your databases. Then when you define dataset use that temporarly datasource in order to populate the available fields. Once the fields are created, you can change the connection back to your dynamic data source. After that delete temporarly datasource and it all should to work.

Creating report by switching between data sources and data sets

I am in a process of generating reports using SSRS. I have multiple servers with multiple oracle databases on each server. I am wondering if I can create multiple shared data sources, and shared data sets, and create one reports by switching data sets and data sources.
Otherwise I will have to create multiple reports for each data source, which can run into 100's of reports.
Any suggestion help would be highly appreciated..
Thanks
Nirmal
Almost everything in Reporting Services is an expression, including the SQL Statement of the dataset. This means it can be altered on the fly. Assuming the datasource credentials you use can access the databases you want to get to, then you just supply the database as a parameter and you're good to go. Of course, for databases on other servers you will need to use linked servers so the server you connect to can link across to the other server to access the database.
We have a table with a nice user readable name for the database such as "End of Financial Year 2009" which holds the database name for that data. Create a dataset to use this as a parameter - display the nice name as the label and get the server+databasename connection string from the value.
Then your dataset just looks like:
="SELECT * FROM " & Parameters!Database.Value & "TableName"
This assumes the databases have the same structures as far as the report's needs are concerned.
You have to set the fields manually but it gives you flexibility.