Search code examples
crystal-reports

Crystal Reports - Remove Carriage Returns


I am writing a report for my company right now and am running into issues with one data set in particular. Our accounting team puts unnecessary (as I see it) carriage returns when typing in data in one of our MISC_COMMENT fields.

Example data:

2 Returns

For warping

Cost = $1

RGA# 123

This comes out on the report as such... The report requester has asked that the data be as follows:

2 Returns For Warping Cost = $1 RGA 123

Is there anyway to strip out the carriage returns? Data will vary in characters and length. Not sure if a substring is still applicable then?

Thanks for the help!


Solution

  • Use the replace function to replace one or both of Chr(10) and Chr(13) depending on whether one or both exist inside your text.

    Replace(Replace(MISC_COMMENT, Chr(13), " "), Chr(10), " ")