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

Report field has trailing spaces trimmed??

Status
Not open for further replies.

ChrisWusfcu

Programmer
Aug 7, 2009
6
US
Environment: CR 2008 and SQL Server 2005.

I have a report field which is sourced from a SQL Server stored procedure result-set column (defined as char(80)). The report field appears to be truncating/trimming trailing blanks (spaces) even though I've confirmed that these trailing blanks are being returned within the stored procedure result-set.

I don't want these trailing spaces (they are not nulls) to be trimmed since they are required by a third party interface file specification. I would like to know if Crystal is truncating these trailing spaces and if so, how to "turn off" this behavior?

Note: I used the Length function in the Crystal Report to confirm that the report field does not contain the trailing spaces.

Thanks in advance!
Chris.
 
Hi,
Try using a formula for that field using the SPACE function, in connection with Length to get to 80 :
@Make80
Code:
NumberVar AddToString := 80 - (Length(Trim({table.Field})));
{table.Field} + SPACE(AddToString)

The TRIM part will eliminate the trailing spaces so that the actual number of spaces needed to get to 80 can be calculated ( otherwise, as you noted, LENGTH will return 80)



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Chris, Please note that you are posting in the incorrect forum. Try either forum767 or forum149 in the future for questions like this.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top