Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS shows no records in report but query returns results

I have a question according to SSRS. I am working with MSSQL Server management studio 2012 and BIDS Visual studio 2008 for the report design.

I have a report with some multivalue parameters and a stored procedure in behind which returns the records.

Now I've tried to find the problem on the parameter values passed to the stored procedure and a string split function. I looked in the SQL server profiler if the strings get passed in an unexpected form but thats not the case. I ran the exact execution code in the server as a query and got results back. but if i run the report in the preview pane of the report designer i get no results back.

If you need any additional infos, just let me know. I just thought there may be someone who faced the same issue and knows the response.

like image 453
karel Avatar asked Aug 27 '13 09:08

karel


People also ask

How do I display no data found in SSRS reports?

To display a message when no data exists in database or no row found for user specified values you can go to report Tablix property. Select report Tablix, then press F4 to open the property window ( in case if you have not already opened), then find a NoRowsMessage property as shown below.

How do I view report data in SSRS report?

To display the Report Data pane In Design view, on the View menu, select Report Data, or use CTRL+ALT+D.

How do you handle null values in SSRS report?

If we are getting the data from a Database, we can use ISNull or COALESCE function to replace Null values with values we would like. But if we want to replace the Null/Blank values in SSRS Report, we need to use IIF and Isnothing functions in expressions.

How do I display error messages in SSRS report?

Error log for SSRS reports: If the SQL Server Reporting Service (SSRS) generated an error message, you can view the error log for additional information. The error log is located in the \Reports\Errors\ userID subfolder, in the base installation directory on the server where TaskMan resides.


1 Answers

I will take a guess and say it is 'how' you are passing the multi value parameter. Personally when dealing with SSRS I use views, table functions, or just selects as SSRS can understand natively that this:

Where thing in (@Thing)

Actually means this in SSMS:

Where thing in (@Thing.Value1, @Thing.Value2, @Thing.Value3, etc...)

I am guessing your proc is taking a string that is actually a comma seperated array. When you do a parameter that takes a string array like '1,2,3,4' and you are addressing the procedure with something like a 'Text' parameter accepting multiple values you either specify or get from a query you essentially need to 'Join' the parameters if your procedure takes a value of a string that contains the array. EG: Proc called dbo.test executes to return rows for values 1,2,4 for a parameter ids are shown like:

exec dbo.test @ids = '1,2,4'

If I wanted to run the proc in SSRS with this value and I had a multi value parameter called 'IDS' I would have to assemble the array manually in a function in SSRS like:

=JOIN(Parameters!IDS.Value, ",")

Essentially telling the proc run a parameter 'IDS' by joining together the multiple values in a chain of comma seperated values. You do this in the dataset on the left pane where it lists 'Parameters' instead of specify the Parameter as it is like [@IDS] you click the 'Fx' instead and put in the function above.

For this reason I am a big proponent of views, selects, and table functions as you can use the predicate logic to take care of this.

like image 62
djangojazz Avatar answered Sep 24 '22 07:09

djangojazz