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

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.

Related

MySQL + SSRS | Stored Procedure only returns one single row

I'm working on several reports for SSRS written in MySQL via ODBC Adapter. For some reason, Stored Procedures only return a single row of data instead of an expected set of data.
Below is the same stored procedure when ran on an SQL Editor:
And below is the stored procedure's execution result when SSRS tries to run it (both on Query Designer and Report Viewer):
I have also set parameters properly as far as i can tell:
so i wasn't able to find an exact answer as to why this happens on SSRS with MySQL via ODBC. What i was able to find was a workaround:
by executing the command as an Expression rather than as a raw query via the Query Editor:
Now the only caveat for this is that the DataSet Fields wouldn't be automatically generated, and that you have to plot them all manually. A good workaround for this is to first run a blank/null query with only the column names (i.e.: SELECT NULL 'column_name_1', NULL 'column_name_2') then later change the query source to Expression. The good thing about using expression is that you only need minor knowledge about how it works and it reduces the confusion with ODBC '?' Parameters.
Cheers!

Calling a MySQL stored procedure with parameters in SSRS reporting through ODBC

In SSRS, when I pass hard-coded values to my stored procedure, it works fine. But it doesn't work when I try to pass the parameters.
Can you please tell me the right syntax for calling MySQL stored procedures in SSRS, through an ODBC data source.
Actually, my problem is either SSRS or the ODBC driver is having a problem sending/receiving the parameter value. Other attempts at syntax:
call shop.GetRegions() ,
call shop.GetRegions(?) ,
call shop.GetRegions(regid),
call shop.GetRegions(#regid)
None of these worked. If I call the procedure with a hard-coded value i.e.
call shop.GetRegions(5)
it works. Again, if the stored procedure has no parameters it works fine. I Want to know How to call MySQL stored procedure in SSRS Reporting? Can You give me any real direction on this issue?
I don't really know where to start with this one because there seems to be a lot of things I could mention, but here it goes...
First, I believe you can use MySQL with SSRS, but I'm not sure why you would want to avoid using SQL Server which is meant to work with SSRS. Additional to that, I'm not sure where this call function is coming from? I've never seen that before unless you went with some custom code.
Next, if this is being done in SSRS, you'll need to call the parameter the correct way. The syntax for referencing parameters in SSRS looks like the following
Parameters!regid.Value
The reason for attempting to call a procedure this way as opposed to loading the data into a dataset is another thing I'm curious about. The easiest thing to do is a dataset getting values from a stored procedure and that way, SSRS typically handles things like this parameter issue in the dataset properties, rather than explicitly calling the procedure.

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 returning different results than the stored procedure

I have a stored procedure that I can call from Management Studio and it returns 56 rows consistently. However, when I execute the query under from inside of ssrs 2008, I get back 61 rows. The stored procedure uses cursors and has some print statement inside of it.
Thanks,
I had a similar problem when I had an a stored procedure return warnings messages. It caused problems returning inconsistent results just in my SSRS dataset/report. I set ansi-warnings to off and my problem went away. You may want to comment out your print statements and try that.
Thanks,
Steve
I would do two things.
Check that the SSRS report is not using cached data - it often does.
If that doesn't help... within your SP write to a table in the DB the params coming in and the data being output. That should point you in the correct direction.
In SSRS, I was trying to pass null as the value of a parameter to a stored procedure. It seemed that no matter what I tried SSRS was using 'null' which did not work with #Parameter is null inside the stored procedure.
I created a report parameter, called #Rs_null, with a default value of (null). I could then use that.
(Creating a report variable was no good since I could not pass that a stored procedure parameter.)
See also How to use stored proc with null parameters in SSRS?

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.