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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manual Line Break

Status
Not open for further replies.

miketbuck

Programmer
Jul 7, 2006
9
US
I'm writing a report that I need to include a manual line break every time a "&" sign is included. My problem is that when there are multiple answers to a question, the application links them with a & symbol. (ie...Alcohol&Caffeine&Cocaine&PCP&) (I work for a drug rehab) What I would like is for this to display like:
Alcohol
Caffeine
Cocaine
PCP

I've created a Replace formula but am unaware of the entry that would cause a line break. So far I've entered spaces, bullets and slashes, but nothing looks the way desired.
Any Ideas?
Replace(String, findstring, replacestring)
 
This should ro the trick:

Replace(trim({YourField}),"&",chr(13))

If your string reallly does end in an ampersand &, you might consider removing the last character so you don't get a blank line at the end:

if right(trim({YourField}),1)="&" then Replace(left(trim({YourField}),len(trim({Yourfield}))-1),"&",chr(13)) else Replace(trim({YourField}),"&",chr(13))


Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
You would need to format the replace formula to "can grow" so you could see all results.

If you wanted to treat each element as a separate field, use formulas like:

//{@first element}:
stringvar array x := split({table.string},"&");
x[1]

//{@second element}:
stringvar array x := split({table.string},"&");
if ubound(x) >= 2 then
x[2]

///{@third element}:
//{@second element}:
stringvar array x := split({table.string},"&");
if ubound(x) >= 3 then
x[3]

Place these in separate detail sections and format each to "suppress blank section" so they won't appear when an element does not exist.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top