How to set up sending an SSRS report via email only when there is data in the report - reporting-services

I want to set up sending via email a SSRS report only when there is data in the report.
It is actually an exception report which needs to send out only when there is an exception.
The data for this is a stored procedure, and there are no parameters for this stored procedure.
I just need to send the email with report when there is any data populated.
I tried the DDS in the SSRS but it did not work for me. Can anyone tell me how to do this ?
The stored procedure just returns results and does not update any table.
There are two CTEs in the Stored procedure and the last line of the query is-
select * from [desks_temporary_allocations_notifications][n] where dateadd(n,10,[notification_date]) > getdate()
This last part of the query returns values only when the where condition is met if the notification table is populated after 10 mins.
The result of this is mostly no rows. I set up a dds where for creating data set I need to write a query which I can't figure out which should only send a report when there is data in the report.
Can anyone help with this .

Related

ssrs report display blank on browser for 2997 rows of data and stored procedure timing is 42 secounds

all data displayed in stored procedure but not in SSRS report on internet explorer,2997 rows of data and stored procedure timing is 42 secounds. if filter is applied then working properly but if by default all is selected then can't display.
This sounds like a problem within the multi parameter within the stored procedure.
You will need to create a function on the server to split the comma-delimited string into values that can be used in “IN” clause or operator.
Example can be found at :enter link description here

SSRS report export error

I have a SSRS report which pulls data from a stored procedure. The report works perfectly fine on the web when im running it with different parameters. However, I get a duplicate row when im trying to export the ssrs report to excel.
The actual reason why the row was duplicating was because of the stored procedure. Instead of distincting the selected values it was picking up duplicates.
Select DISTINCT
There fore using a simple sql fixed it.

SSRS won't read my SQL query parameters

I'm trying to plot data to a shapefile in SSRS. I linked my SQL Server successfully and selected my Stored Procedure, but when I go to set my Spatial and Analytical Dataset Fields SSRS tells my
Procedure or function 'uspStoredProcedure' expects parameter '#eventId', which was not supplied.
I don't understand because I explicitly entered eventId on the page directly before this, ran the query and everything came up just as expected.

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.

Populate an SSRS Report parameter(hidden) by a sproc or user defined function

My SSRS report fetches data from my DATAWAREHOUSE.
The ASP.NET application I have is connected to an OLTP database.
I invoke the SSRS Report from my ASP.NET application and provide a parameter as CustomerID(this is an application key in datawarehouse) to my report.
Since my report is connected to my datawarehouse, I do not query my report databased on the OLTP's CustomerID. Instead I use my datawarehouse's surrogate key (CustomerDimKey).
Now, in my report, I need to find the correct surrogate key for the CustomerID parameter, which I passed from my ASP.NET application!
My report already has a parameter as #CustomerDimKey(this is used across all the report sprocs). We used it for testing, but now we'll hide this as we have integrated it with the ASP.NET application.
I have already added a new parameter to the report as #CustomerID(this will have the OLTP's CustomerID), which will now get a value from ASP.NET.
I need to know a way to re-use the #CustomerDimKey report parameter, which should now get value from a sql statement or a sproc once the report is requested.
Based on the value contained by the #CustomerID parameter.
Sounds pretty simple. Assuming you have SQL or a stored proc that can look up the CustomerDimKey, just add a dataset that does so using #CustomerID parameter then selects that CustomerDimKey. Let's assume it's a stored proc called LookUpCustomerDimKey that takes the #CustomerID and an output parameter #CustomerDimKey. I'd create a report dataset like so:
declare #CustomerDimKey bigint
exec LookUpCustomerDimKey #CustomerID, #CustomerDimKey out
select #CustomerDimKey CustomerDimKey
Then set the CustomerDimKey report parameter to be internal and get its default value from the query I just created. Now the report will wait for CustomerID to be provided then calculate the CustomerDimKey before using it in your other report datasets.
It doesn't have to be a stored proc, of course. You just have to make sure the body of the dataset produces a single row result set containing the key. It can be a simple SQL select or a series of TSQL statements or stored proc calls. Pretty much anything that you could put into a stored proc can go into the dataset body. It just needs to ultimately produce a row.
Ensure that you keep the order of parameters correct, during design.
#CustomerID -- First parameter
#CustomerDimKey -- Second parameter and depends on #CustomerID for its value.
Ensure the new dataset returns a resultset with single record(value)
declare #CustomerDimKey bigint
SELECT #CustomerDimKey = CustomerDimKey FROM Datawarehouse.CustomersDimension WHERE CustomerID = #CustomerID
select #CustomerDimKey AS CustomerDimKey