Solved

Reporting Services: How to know if the report is empty

Posted on 2008-10-20
12
686 Views
Last Modified: 2013-12-17
I am working on a web application which shows reports builts from Reporting Services. To show the report on the page I use a Report Viewer. I would like to know if there is a way to check whether the report has data before showing up the report.
0
Comment
Question by:karakav
  • 6
  • 6
12 Comments
 
LVL 12

Expert Comment

by:jgv
ID: 22760651
There's no method you can use through SSRS to check for this condition. You would have to independently run the same query that the report uses to see if there are any records. If you are asking because you want to show an appropriate message to the user in this situation there is a property for this. If you are using a List or Table object, look for the "NoRows" property. You can fill in a message that you want displayed on the report when no data is returned (ie: "No data was found matching your input")
0
 
LVL 4

Author Comment

by:karakav
ID: 22766260
What do you mean by "Using a List or Table"? Because me I directly show the report in a Report Viewer control.
0
 
LVL 12

Expert Comment

by:jgv
ID: 22766465
To set the NoRows property you have to edit the report in the report designer. This property should be available on the main object used to show the data (a Table, List, Matrix, etc). Did you build the report yourself or is this a report someone else built?
0
 
LVL 4

Author Comment

by:karakav
ID: 22766663
I did it myself. The problem is that I don't manage to format that message so that I resemble the messages shown in the application.
0
 
LVL 12

Expert Comment

by:jgv
ID: 22767499
I'm not really sure what you mean by that last comment. Does the NoRows message shown in the report have to match something that is shown in your application (ie: the message can change each time the report is run?)

If you want to be able to set the NoRows message from your application you could create a "dummy" parameter that is set to Hidden and allows blank values. Pass a message into this parameter that will be shown if there is no data. The expression for the NoRows property would be something like this:
=Parameters!MessageToShowIfNoData.Value
0
 
LVL 4

Author Comment

by:karakav
ID: 22768378
My concern about the format is: For instance in the whole application, if a gridview doesn't contains data, I show a label with no data message. That label has same format: read font with special character. My problem is that inside the report designer, I can only define the no data message, but I can't define how that message will look like.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 12

Accepted Solution

by:
jgv earned 500 total points
ID: 22768707
Ok. Assuming that you are using a table, try this instead.

Add a Table Header and merge the cells
Enter a "no rows" message and format it the way you want.
Select the row and enter this in the Hidden property (replace the field name and dataset name)
=IIF(Count(Fields!AFieldInYourDataset.Value,"YourDataSetName")=0,False,True)
0
 
LVL 4

Author Comment

by:karakav
ID: 22768983
And what do I do mi mu current table header?
0
 
LVL 12

Expert Comment

by:jgv
ID: 22769057
You can have more than 1 table header. Right click the table header row and select "Insert Row Above"
0
 
LVL 4

Author Comment

by:karakav
ID: 22769216
Yeah, I saw. The problem is that my columns are dynamic and I don't in advance which columns will be displayed.
0
 
LVL 12

Expert Comment

by:jgv
ID: 22769477
Your choices are pretty limited. You could place another table on the report just above your existing table. Only include the table header row with the message but set the Hidden property on the table itself.
0
 
LVL 4

Author Closing Comment

by:karakav
ID: 31507911
OK. I will try it. Thanks very much for you help. It was very much appreciated.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now