Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Line Break into Concatenation 2

Status
Not open for further replies.

jollyreaper

Technical User
Jul 25, 2005
105
US
I need to change the way a formula is working. Right now it's taking variables and making them look like this: "variable 1, variable 2, variable3"

I need to make it look like:

"Variable 1
Variable 2
Variable 3"

I'm using logic to remove variables that are blank.

dim text as string
if {COLORC.CHOICE1} <> "" THEN
Text = Text + {COLORC.CHOICE1}
end if
if {COLORC.CHOICE2} <> "" THEN
Text = Text + ", " + {COLORC.CHOICE2}
end if
if {COLORC.CHOICE3} <> "" THEN
Text = Text + ", " + {COLORC.CHOICE3}

I saw mention of using chr(13) but I think that's just for ASP. I know this has gotta be an easy one. Help! Thanks.
 
actually the aschii code for carriage return is chr (10)

something like this should do

if {COLORC.CHOICE1} <> "" THEN
Text = Text + {COLORC.CHOICE1}
end if
if {COLORC.CHOICE2} <> "" THEN
Text = Text + chr (10) + ", " + {COLORC.CHOICE2}
end if
if {COLORC.CHOICE3} <> "" THEN
Text = Text + chr (10) + ", " + {COLORC.CHOICE3}



-Mo
 
Well, this is pretty weird. Looking through the site more, it says chr(13) or (10) should work. I made a test formula and it worked ok, still not sure why it's not working in my big formula.
 
One is Carriage (10) return the other is line feed (13) and because is electronic they both work on the old typewriter you needed both.

I think you are also missing semicolons

if {COLORC.CHOICE1} <> "" THEN
Text = Text + {COLORC.CHOICE1};
if {COLORC.CHOICE2} <> "" THEN
Text = Text + chr (10) + ", " + {COLORC.CHOICE2};
if {COLORC.CHOICE3} <> "" THEN
Text = Text + chr (10) + ", " + {COLORC.CHOICE3}
else
Text


-Mo
 
Ok, I sussed out the problem. It's called "Crystal Reports is buggier than a Windows Beta."

I designed the original report months back and everybody was fine with it. Now all these months later, they want to make a change. No problem, right?

I run the damn report from Crystal Server and I see all my data fields no problem.

I open the same damn report in Crystal Reports, make no modifications, run it, the very field I'm trying to work with disappears! Since I knew it was working in Server I didn't try running it first in Reports, I just opened it, saved a new copy so I would have the original, and ran it. It'll render in Server but not in Reports.

I got off the phone with Crystal support. They're stumped, promised to call me back. Insane. Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top