Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Crystal reports trimming spaces at the end of fields.

Posted on 2004-03-31
5
Medium Priority
?
384 Views
Last Modified: 2012-08-14
Hi,

I am placing multiple fields into a text box.  These each of these fields in the database contain a space at the end.  For some reason crystal reports is removing these spaces.  I need it to place a space between each of the fields.  I attempted to put a space in the text box between the fields, but if the field is blank it will leave two spaces.

Thanks
0
Comment
Question by:FTIISD
[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
  • 3
5 Comments
 
LVL 42

Accepted Solution

by:
frodoman earned 2000 total points
ID: 10727084
That's going to be tough to overcome with a text box because you have little or no control over how Crystal formats it.

I would consider instead creating a formula so you can control the results.  Something along these lines:

================================
stringVar MyResult := '';

If trim({table.field1}) <> '' Then
  MyResult := {table.field1};

If trim({table.field2}) <> '' Then
  MyResult := ' '+{table.field2};

If trim({table.field3}) <> '' Then
  MyResult := ' '+{table.field3};

...etc...

MyResult;

================================

0
 
LVL 42

Expert Comment

by:frodoman
ID: 10727093
Sorry for the typo, should actually be:

================================
stringVar MyResult := '';

If trim({table.field1}) <> '' Then
  MyResult := {table.field1};

If trim({table.field2}) <> '' Then
  MyResult := MyResult+' '+{table.field2};

If trim({table.field3}) <> '' Then
  MyResult := MyResult+' '+{table.field3};

...etc...

MyResult;

================================
0
 

Author Comment

by:FTIISD
ID: 10727138
Is there any other way to do this?  Is there a reason that crystal reports is removing these spaces? I have an extremely long reports, and this method will take a long time.

Thanks.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 10727232
I have no idea "why" but it's not even consistent between versions.

How long your report is doesn't matter as much as how many fields you're combining into a single text box.  I don't know of an easier way to do this.  Honestly I usually just put the space between the fields and ignore the extra spaces when they happen - I use a variable width font so you have to really look closely to see the difference between one space and two anyway.


0
 
LVL 101

Expert Comment

by:mlmcc
ID: 10729405
The formula idea will work for CR9 and 10.  For earlier versions so long as the text doesn't exceed 255 characters it will work.

The inserting into a text box is the method for getting around the ength limitation.

I agree with frodoman, if single vs double space is important use the formula.

mlmcc
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

664 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