Solved

Suppressing blank lines in an address block

Posted on 2011-03-18
5
455 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

707 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