Solved

SSRS Expression returning an #Error

Posted on 2013-06-10
3
750 Views
Last Modified: 2013-06-11
Hi, I have this expression in the report header that takes the value from  the first record in the main recordset and pops it into the report title.  The problem is when NO records are returned by the main recordset, I get an error.  

Maybe I've got this all wrong to begin with b/c it assumes records will be returned.  What's the best way to handle no records in my report header expression?

="Total Number of Widgets: " & IIF(IsNothing(First(Fields!NbrOfWidgets.Value, "MainRecordset")), "0", First(Fields!NbrOfWidgets.Value, "MainRecordset").ToString)
0
Comment
Question by:MariaHalt
3 Comments
 
LVL 11

Expert Comment

by:srikanthreddyn143
Comment Utility
Countrows("dataset") returns you number of rows returned. Make sure that this value is greater than 0 to populate from the first record
0
 
LVL 27

Accepted Solution

by:
planocz earned 500 total points
Comment Utility
This is what you need...

 ="Total Number of Widgets: " & IIF(CountRows("MainRecordset")=0,"0",(Fields!NbrOfWidgets.Value, "MainRecordset"))
0
 

Author Closing Comment

by:MariaHalt
Comment Utility
So straightforward, thank you.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

It is helpful to note: This is a cosmetic update and is not required, but should help your reports look better for your boss.  This issue has manifested itself in SSRS version 3.0 is where I have seen this behavior in.  And this behavior is only see…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

743 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

8 Experts available now in Live!

Get 1:1 Help Now