Reuse of SSRS Report parameter - sql

I am new to SSRS, I am creating a report which will take ID's as parameter e.g. 1,2,6,7,8,9 and so on. This parameter will be used for multiple reports. As a good practice I am thinking the user should not enter the ID for each report. Once entered/selected the ID parameter should be persistent for all the reports.
I am using Visual Studio 2008 to create the report and SQL Server 2008 R2 for backend scripting.

This can be done in an elegant way, but requires some work on the back end database.
If your reports are executing stored procedures, you can have the stored procedure for each report write the user's choice of a parameter to a table. Then the next report can check that table for a value. You could design this to be user specific, time-dependent, etc., depending on the effort you put in. It might be cleaner to set the parameter in a separate dataset. That is, in each report, you have multiple datasets. One grabs the parameter value, and your report parameters will default to that result. The other report data set can display the "main data."

Related

How to pass a local access table as parameter to SQL server?

I am modifying an access 2010 application so that it uses SQL server to run its queries. The data has been transferred to the server some times ago, and used as linked tables, but that proves a bit slow and non-optimal. So I'm trying to put the queries on the server.
I have no problem for simple queries, views,... and I'm using stored functions when there is a need for simple parameters (dates, ids,...).
But now I have a process in that application that selects a bunch of ids in the database, stores them in a local table, does a bunch of actions on them (report with sub report, print preview, print, update of the original records with the date of print when the user confirms that everything printed OK), and empties the local table if all actions succeed.
I can't simply use an SQL server table to store the ids since many people use the application at the same time, and the same table is used in several processes; I can't use temporary tables since they disappear as soon as access goes to the next action; and I can't find a way to use a local table as a parameter to server stored procedures. Basically I'm stuck.
Can anyone help? Is there a way to do that (pass a bunch of values as a table to a server stored function)? Or another process that would achieve the same result (have a table on the server specific to the current user, or a general table and somehow identify the lines belonging to current user, or anything else)?
There are 2 methods that I use. Both work very well for multi-user apps. Here are the basics. You'll need to work out the details.
Create a table (tblSessions) in SQL Server with an identity column SessID (INT NOT NULL).
Create a function in Access to generate and retrieve a new SessID.
Create a second SS table tblWork with 2 columns SessID, YourID. Add appropriate indexes and keys. Link this table to your Access app. Then instead of inserting the IDs for your query into an Access temp table, insert them into tblWork along with a new SessID. You can now join tblWork to other SS tables/views to use as the datasource for you reports. Be sure to add the SessID that you generated to your where clause.
Create a stored procedure to generate the data for your reports. Include a parameter #YourIDList VARCHAR(MAX). Call the proc via a passthrough queryand pass the list of your IDs as a comma (or whatever you prefer) separated string to #YourIDList. In the proc, split #YourIDList into a temp table. SS2016+ has a STRING_SPLIT function. For older versions, roll your own. There are plenty of examples available. Then join the temp table to the other tables you need to generate your output. Use the PT query as your report datasource, or dump it into an Access temp table and use that as you report datasource.

Executing Stored Procedures in SQL with automatic date

There is a software (called StackVision) that uses "SQL Server Reporting Services" for creating some reports. More information about the software is here.
I am trying to make a new "View" out of a couple of "Stored Procedures" in the database. I do not want to mess with the stored procedure coding though. I just want to run a code to build a new "View" out of the results of "Stored Procedures." The following code can run one of the desired stored procedures.
EXECUTE [dbo].[ss_Total]
#StartDate ='07/1/2020'
, #EndDate='09/30/2020 23:59'
, #ParameterA='AA'
, #ParameterB='BB'
,#INterval = '001H'
Does anyone know who I can execute the following "Stored Procedure" only on last quarter. Instead of putting a certain date (such as '07/1/2020' and '09/30/2020 23:59'), I would like to have a coding that tells the stored procedure to be conducted from the beginning of last quarter to the end of last quarter. Assume that the date is 10/2/2020.
BTW, the software also run the stored procedures to create some reports.
The reason that I am doing this:
I built a Power BI report by connecting the Power BI report to the Stackvision server. The Power BI report, calls/runs the stored procedures and then append/merge tables to create a report. Unfortunately, the Power BI server fails to refresh the data. So, I am thinking to create one "view" in the database and only pull that view into Power BI. Then the Power BI server will not time out and will not fail anymore.
You can add the date 3 months from your initial param.
here the link:
https://www.w3schools.com/sql/func_sqlserver_dateadd.asp
I don't know what your DB using, if you using MySQL try this for example
SELECT ADDDATE(NOW(), 90) as datethis

How to let end users customize report chart in SSRS?

i am working on sql server business intelligence to generate reports. i did all the staff that i want to be in the report except the ability for the end user to customize the report without making another request to the server to generate another report based on another request. first i did this through a parameter of type Boolean and wrote an expression to check the parameter before generating the report,but my project leader said i don't want to make a request each time instead i want to bring all possible data and let the end user decide what to show.
in other words, my report contains a chart of three series i want the end user have the ability to show a set of them or all of them in client side + one request.
how can i do it through sql server business intelligence 2008
What is Your SSRS project based on ? SQL Server DataBase or SQL Server Analysis Service ?
AFAIK you can design the SSRS report with many conditions which the end user can input their own value in .
if It's based on SQL Server DataBase the conditions looks like parameters of procedure that you use in SSRS
if it's based on SSAS , The conditions looks like MDX code

Automatic parameter generation from Stored Procedure SSRS 2005

I have a ssrs 2005 report that has a stored procedure on sql server 2005 as its datasource.
At first, the sp had no parameters, it just returned values.
The sp changed now, a lot of parameters were added.
Now i need to add report parameters for the report, and bind them to the sp parameters
Is there a way for the report to automaticaly generate the parameters and bind them to the sp parameters ?
Usually, When you look in the DATA tab in the RDL design, you can see the datasets that your report uses.
In there, there's a refresh icon that refresh the information from the procedure.
After the procedure has changed, you need to refresh the RDL's dataset.
Once you refresh the dataset, the parameters should be added automatically.

How To use a stored procedure in a crystal reports 8.5?

I have to make a new report using crystal report8.5 .
I have created a stored procedure in SQL Server 2005. The stored procedure has one input parameter.
Now I wanna to know that how I can add that stored procedure and show its result in my report
while designing that report?
thank you
First go to File > Options > Database (going from memory) and make sure the checkbox for Stored Procedures is ticked. Then, when you setup your connection to SQL Server, as well as a Tables section you'll see a Stored Procedures one beneath it. Find your stored procedure in the list, add it as the data source for your report, and you'll be able to use it as a normal source.