Run SSRS subscription with different parameters - reporting-services

Is there a way to programmatically execute an existing subscription with different report parameters?
So far I execute subscriptions via SQL as follows:
EXEC ReportServer.dbo.AddEvent 'TimedSubscription', '<Subscriptions.SubscriptionID>'
But this seems to only allow me to execute the subscription as-is.
Edit:
I wanted to do this for our existing subscriptions (50+ total).
Manually re-creating each subscription is not feasible.

The first commenter in this article updates the Parameters value in the Subscriptions table via a Stored Procedure before running the AddEvent command:
update Subscriptions
set Parameters=
'<ParameterValues><ParameterValue><Name>Value</Name><Value>' + #value + '</Value></ParameterValue></ParameterValues>'
where SubscriptionID='XXX-XXX-XXX-XXX'

The way I worked through this problem was to set up a data driven subscription on the report that populated the parameters based on the values held within a specifically designed SQL table. I then set up a stored procedure that populated that table with the values that were required and then fired the subscription using AddEvent.
You may run into issues with this approach if you need to run fire the subscriptions more frequently than it takes to produce the report and thus cleaning out the lookup table. If the report isn't that frequent though, you should be fine.

If I'm understanding your question correctly, you could take 2 of the following approaches:
Approach 1
Step 1: Navigate to the report you would like run with different parameters.
Step 2: Select to manage the report
Step 3: Select to Create Linked Report
Step 4: Choose the location where the report can live.
Step 5: For the new linked report, click to manage the report
Step 6: Change the default parameters you'd like passed
Step 7: Create subscription for new linked report.
Approach 2
Step 1: Navigate to the report you would like run with different parameters.
Step 2: Select to manage the report.
Step 3: Create a subscription for the report
Step 3a: While creating subscription, specify what values you want passed.
Hope this helps!

Related

How to View Data In SSRS Reports

I have an SSIS package, There are only two tasks in my SSIS package. One is Execute SQL Task and another one is Data Flow Task. My first task is doing to truncate a table (Table_1) and second task is just load data in truncated table means Table_1. An SSRS report get data from that table means Table_1. My SSIS packages run every hour. when SSIS package running in the same time users has complaining that they are not able to view data in the report. How do I do that my SSIS package start running. Users can able to view data in my Report.
Off the top of my head, have a table that stores values on whether this deal is running or not, doing something like setting a single value to 1 when running and 0 when not running.
Then in your SSRS, instead of a 'SELECT * FROM Table_1', write a stored procedure that has logic to lookup the value in the above table. If 0 return the set normally, if 1 then return some kind of friendly message that data is currently being loaded and the report is not available.

what runs the subscribed report in SSRS?

so my question is, what runs the subscribed report in SSRS ? I mean when I subscribe to report and give it a desired time when it should run and send me the file. something does this right ? so I want to know what runs it ? is it a procedure in SQL function ? well the reason why I want to know this is that I want to run SQL update before each time this scheduled report starts.
I can just create procedure that will do the update I want before the scheduled time but, still it will be more practical to integrate it within the job itself
Short answer, these subscriptions are run as database jobs through the SQL Server Agent.
They are created with GUID type names:
The one job step will have a command like:
exec [ReportServer].dbo.AddEvent #EventType='SharedSchedule', #EventData='8df4ff30-97d3-41f7-b3ef-9ce48bfdfbfa'
You can trace these jobs/GUIDs back to the subscription and report through the ReportServer database using the Subscriptions table and its MatchData column (matches the job GUID) and the Catalog table which includes the report data (i.e. linked through the Subscriptions.Report_OID column.
You can use this information to check what's scheduled and based on this schedule your update appropriately.
I haven't tried it myself, but one option could even be to hook into the existing database jobs, but I would approach this with caution; I can't see any issues but maybe it's best not to update any system created jobs like these.

SSRS call stored procedure using ReportItems! textbox. Maybe custom report code?

I need to call a stored procedure during my report to insert values into a table. These values are the result of fields from the dataset added. For example, I have a row of values, and the far right column is "ReportItems!TextBox1.Value + ReportItems!TextBox2.Value ..." This gives the correct total on the report. Now I need to call a procedure using this value as a parameter.
Using a stored procedure as a dataset, I am unable to reference the ReportItems! I am also unable to create additional report parameters (even internal or hidden) which could be a result of a dataset due to the reporting infrastructure we are using.
I know using custom report code, I can call a stored procedure and also reference the ReportItems, but I have been unable to find the correct syntax. I am not familiar with VB.net so please be specific. If i could get an example of how to call: Procedure TEST_INSERT(ReportItems!TextBox1.Value), I would be able to figure out how to implement it.
I am using an oracle backend as my data source.
Thanks
If I've understood you correctly, you want to do an database update using a value calculated with an expression in your report. My answer to this would be threefold.
First up: don't do it!.
Second: seriously, don't do it!! Reporting services is not meant or well suited for this kind of task, you most likely are looking at an XY-Problem.
Third, if you insist on doing it anyways, the easiest way I can think of to accomplish that is by using a seperate report to trigger the update, and pass the value you're after into a parameter for that report. In the main report, you set a click action on the cell with the total that calls the report, with the same value into the parameter.
A similar setup which may work as well, is to create a parameter based on the first dataset with that same "sum" expression you mention, and pass that down to another dataset.
However: don't do it! ;-)
I would set up a dataset in the report service that calls an update or insert function in oracle and returns a value/s. This way you can send in the total you need calculate and produce a result telling the user if the update was successful.
There is no special method for doing this just select or enter your procedure name and refresh the fields to update the parameter/s. See Oracle stored procedure in SSRS.
Also using this method you can run the stored procedure in oracle, update the table and display the results.

SSRS dataset not refreshed after changing MySQL stored procedure

SSRS dataset not refreshed after changing MySQL stored procedure.
I created an SSRS report in which the dataset gets data from MySQL stored procedure. In this scenario the output is generated correctly and so is the report.
Later I modify some content in the stored procedure. I run the stored proc in query designer. In query designer it gives the correct output.
But when going to report if I see the report in preview tab it gives old values. Changed are not coming in presenting report.
Please tell me what's wrong.
Try deleting the MySolution\MyProject\MyRDL.data file -- BIDS caches fairly aggressively.
This is a bug in Visual Studio i think it happens to me as well. Usually closing the report in Visual studio and reopening helps.
the report may be cached on BIDS for a few moments.
re-open it and it should be fine
I TESTED IN VS2012
Note :
1. Go to your Report designer
2. Remember(or copy somewhere) your (A) Data Source Name and (B) Data Sets Name
Now Step 1:
In the Project Solution Explore Delete the Data Set (same name as in Note(A) Data Source Name
) Don't Worry Nothing will bad on your report :)
Step 2:
open the Report data tool of your report
Step 3:
* Select dataSet --> Right Click ----> Select DataSet Properties
* In " data source" click on NEW button---->Next---->
* Select your table/sp/views/-----> Put the Data set Name as:(Note 2. Remember your (A) Data Source Name )
Now Finish... :) now you can get your Newly added field in SP
NOTE : ONLY REMEMBER your old data source and dataset name
Thanks, enjoy ...
Regards,
SRSahoo#gmail.com
Also be sure it's the report and not you.
I switched the sorting fields in the dataset and they weren't changing in the report preview because I didn't change the Grouping.

SSRS Code and Automated Reports

I am currently trying to automate reports using SSRS in SQL Server 2008, requiring little to no user input at all.
I have the queries already to acquire the data, but they require datetime parameters which are retrieved from an invoices table in the database.
Is there any way to automate this, without requiring user input? I'd like to have these reports fire off every Monday morning without prompting. We also have an internal web site which is used for administrative work, written in ASP and C#, that I can use in conjunction in need be.
Regards and thanks
You should be able to do this. In each report you can set a query to retrieve parameter values and you can also specify a query for the default values.
So
Add a parameter and have that parameter be passed to your stored proc that gets your data
Set the available and default values for that parameter to a sql query that returns the value you need for the parameter.
You'll need to do this for each parameter. Then as long as all parameters in the report have default values the report will run without prompting for parameters.