[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Suppressing blank lines in an address block

Posted on 2011-03-18
5
Medium Priority
?
457 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 101

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 101

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 Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 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