Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Crystal Concatenate Formula

Posted on 2012-04-04
Medium Priority
482 Views
I want a formula that only prints if the address line if it exists. If I have 6 lines and 3 are blank I would like it to look like this: -
(Without leaving blank lines between 3 and 6)

I have this formula but it misses Addr6: -
{Addr1} & Chr(13) & Chr(10) &
{Addr2} & Chr(13) & Chr(10) &
{Addr3} & Chr(13) & Chr(10) &
{Addr4} & Chr(13) & Chr(10) &
{Addr5} & Chr(13) & Chr(10) &

Can anyone help?
0
Question by:HKFuey
[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
• 3
• 2
• 2
• +1

LVL 77

Expert Comment

ID: 37806187
A common way of dealing with this is to create multiple detail sections  (or whichever section you are using to display the address) and put each address line in a different section.  You can then set each section to Suppress when blank.
0

Author Comment

ID: 37806243
Thanks for the suggestion but this address is on a customer statement and the format will not allow this ; (
0

LVL 101

Expert Comment

ID: 37808934
ANother way is to have a single text box
You can drag each field in in turn separated by CR

You can format the text box to suppress the blank lines

mlmcc
0

LVL 101

Assisted Solution

mlmcc earned 800 total points
ID: 37808954
The problem with your formula is that as soon as it finds a null field it ends

You are saying

if addr1 is null then do nothing
else  Concatenate the rest to Addr1

You need ( ) around the ifs but I am not sure how to use them

The way I generally do this is

Local StringVar strOut;

If strOut = "" then
Else
strOut := strOut & chr(13) & chr(10) & Addr2;

If strOut = "" then
Else
strOut := strOut & chr(13) & chr(10) & Addr3;

If strOut = "" then
Else
strOut := strOut & chr(13) & chr(10) & Addr4;

If strOut = "" then
Else
strOut := strOut & chr(13) & chr(10) & Addr5;

If strOut = "" then
Else
strOut := strOut & chr(13) & chr(10) & Addr6;

strOut

mlmcc
0

LVL 35

Accepted Solution

James0628 earned 1200 total points
ID: 37809560
I think mlmcc is right.  You don't have the if-else statements separated, so the logic reads

""
else
<everything else>

Try this:

(
)
&
(
)
&
(
)
&
(
)
&
(
)
&
(
)

James
0

Author Closing Comment

ID: 37809824
The brackets did it!! Thanks very much!
0

LVL 35

Expert Comment

ID: 37809880
You're welcome.  Glad I could help.

James
0

LVL 101

Expert Comment

ID: 37811616
Thanks James.  I didn't have a dataase setup to validate the syntax.  I thought it was something like that but wanted to test it first.

mlmcc
0

## Featured Post

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â€¦
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â€¦
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vulnâ€¦
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signalâ€¦
###### Suggested Courses
Course of the Month8 days, left to enroll