Solved

Suppressing blank lines in an address block

Posted on 2011-03-18
5
449 Views
Last Modified: 2012-05-11
Okay, I've been fooling around with this about an hour. It's time to bring in the experts!

I'm using CR 2008.

I'm trying to suppress blank lines in an address block on a form I'm creating (customer statements). I'm a professional programmer just starting to fool around with CR.

Bad:
===============================
Acme Hardware
123 Easy Lane
(blank)
New York, NY  12345
===============================

Good:
===============================
Acme Hardware
123 Easy Lane
New York, NY  12345
===============================

I've tried to solve this using a formula. I've set it to "Basic Syntax". (See attached)

The formula is returning blanks.

What am I doing wrong?

Thanks for your help.

Jim
dim buf as String

buf = {COMPANIES.COMPANY_NAME}

if Length({COMPANIES.ADDRESS1}) > 0 then 
  buf = buf & Chr(13) & {COMPANIES.ADDRESS1}
end if

if Length({COMPANIES.ADDRESS2}) > 0 then 
  buf = buf & Chr(13) & {COMPANIES.ADDRESS2}
end if

if Length({COMPANIES.ADDRESS3}) > 0 then 
  buf = buf & Chr(13) & {COMPANIES.ADDRESS3}
end if

if Length({COMPANIES.CITY}) > 0 then 
  buf = buf & Chr(13) & {COMPANIES.CITY} & ", " & {COMPANIES.CITY} & "  " & {COMPANIES.ZIP_CODE}
end if

if (Length({COMPANIES.COUNTRY}) > 0) and ({COMPANIES.COUNTRY} <> "US") then 
  buf = buf & Chr(13) & {COMPANIES.COUNTRY}
end if


formula = buf

Open in new window

0
Comment
Question by:jrollins138
  • 2
5 Comments
 
LVL 12

Expert Comment

by:JayConverse
ID: 35168444
Rule #1, know your data.

Perhaps you need Length(Trim({COMPANIES.ADDRESS3})) > 0
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35168552
I don't see anything wrong with the formula so long as the fields are empty or NULL if they don't have a value.

Since that isn't the formula you are using since it has CITY in twice and missing State.

Can you copy and paste the actual formula?

mlmcc

0
 

Accepted Solution

by:
jrollins138 earned 0 total points
ID: 35168571
Found the answer:

There's an option at the top of the Formula editor dialog that deals with Nulls. I needed to set the choice to "Default Value For Nulls". The default setting was "Exception for Nulls".

What was happening was the blank fields were, in fact, null and the "Exception" was being triggered which caused the formula to return a blank.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35399277
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

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

11 Experts available now in Live!

Get 1:1 Help Now