Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 2nd, 2008, 05:11 PM
Registered User
 
Join Date: Dec 2007
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...

Name
CompanyName
AddressLine1
AddressLine2
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.

Thanks.


=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"))
 
Old January 3rd, 2008, 12:23 AM
Friend of Wrox
 
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default

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

urt
 
Old January 3rd, 2008, 02:40 PM
Registered User
 
Join Date: Dec 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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"))
 
Old March 17th, 2008, 11:40 PM
Registered User
 
Join Date: Mar 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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






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 04:49 PM
Error - Missing operator in query expression. akibaMaila VB.NET 2002/2003 Basics 1 January 18th, 2005 12:34 PM
Expression causes an Aggregate error Mitch SQL Server 2000 3 November 18th, 2003 04:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.