Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > Reporting Services
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Reporting Services SQL Server Reporting Services. Please specify which version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Reporting Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old January 2nd, 2008, 04:11 PM
Registered User
Join Date: Dec 2007
Location: San Diego, CA, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Expression error

I'm trying to display some address information on a billing invoice like so...

City, State Zip

If AddressLine2 doesn't have any data, I want to print City, State, and Zip in it's place. I created this expression which doesn't have any syntax issues but displays #Error when the report is generated. I also tried adding Table and List Item data regions and removing the dataset from the expression but it still returns #Error.

Since #Error isn't very intuitive, I was wondering if anyone could tell me what is wrong with my expression.


=IIF(Len(First(Fields!AddressLine2.Value, "STMTACCTINFO") > 0), First(Fields!AddressLine2.Value, "STMTACCTINFO"), First(Fields!City.Value, "STMTACCTINFO") & ", " & First(Fields!State.Value, "STMTACCTINFO") & Space(1) & First(Fields!ZipCode.Value, "STMTACCTINFO"))
Reply With Quote
  #2 (permalink)  
Old January 2nd, 2008, 11:23 PM
Friend of Wrox
Join Date: Oct 2007
Location: , , .
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi

What is the definition of first function. You debug each component of first used in your statement.

Reply With Quote
  #3 (permalink)  
Old January 3rd, 2008, 01:40 PM
Registered User
Join Date: Dec 2007
Location: San Diego, CA, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

Taking out the Len() function and checking for the value = "" works. This wouldn't work of course, if the field was returning NULL but then you should be able to use the IsNothing() function instead.

I'm sure there's a way to use the Len() function without error and I would still like to figure it out but for now I'm going with what works.

=IIF(First(Fields!AddressLine2.Value, "STMTACCTINFO") = "", First(Fields!City.Value, "STMTACCTINFO") & ", " & First(Fields!State.Value, "STMTACCTINFO") & Space(1) & First(Fields!ZipCode.Value, "STMTACCTINFO"), First(Fields!AddressLine2.Value, "STMTACCTINFO"))
Reply With Quote
  #4 (permalink)  
Old March 17th, 2008, 11:40 PM
Registered User
Join Date: Mar 2008
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

I would hide the row if Address2 is null. It is easy and you can save a lot of time typing Iif.

Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
XPath Error : Expression Expected deean XML 1 June 14th, 2008 05:57 PM
Message> in query expression <expression>. (Error ybg1 Access 5 July 15th, 2007 05:42 AM
Regular Expression Error kwilliams ASP.NET 1.0 and 1.1 Basics 3 February 16th, 2006 03:49 PM
Error - Missing operator in query expression. akibaMaila VB.NET 2002/2003 Basics 1 January 18th, 2005 11:34 AM
Expression causes an Aggregate error Mitch SQL Server 2000 3 November 18th, 2003 03:20 PM

All times are GMT -4. The time now is 01:34 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.