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

How do I pad a field with blanks in Crystal Reports?

Status
Not open for further replies.

rorymo

Technical User
Nov 7, 2003
75
US
Hello,

Crystal Reports XI
Sql Server 2000

I have a report that is using a field that is defined in the database as a string field, 21 characters long.
My report brings in this field as a string, 21 characters long.
I made sure that the display field on the report is large enough to show all the data.
The data in the database does not always consist of 21 characters (actually is is all numeric data).
Sometimes there are 7 numbers, sometimes 5, sometimes 21.
I did a len({fieldname.table}) and it did show that the number of characters in the field was indeed variable.
Also, the data is not only variable length, but appears in different positions within the field itself.
(left justified, center, right justified)
I need to know how to pad the field so that it would always be 21 char regardless of whether there are blanks in the field or not.
Is there any way to do this?
Thanks in advance for the help.
Rory

 
Use a formula, as in:

replicatestring(" ", 21-len(trim({table.field}))) & trim({table.string})

-k
 
Thanks for the reply, I'll go try it now.
R
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top