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

Adding Whitespace

Status
Not open for further replies.

WilGrl

Technical User
Jul 3, 2003
8
CA
I have been searching on the internet, and within this forum and I think that I must be the only person in the world who WANTS to add whitespace to my report. We are being asked to submit a report to the government on a monthly basis and it need to be in a specific format. For example, the driver's name needs to take up 100 spaces. If it only takes up 20 then the other 80 places need to be filled in with spaces. This was the first month and I spent a great deal of time pressing the spacebar in microsoft word. Is there anyway to do this with crystal???

Thanks in advance for all your help.
 
Sure, you can create a formula such as:

replicatestring(" ",100-len(trim({table.field})))

Adjust the 100 to the length of the field you need. If it's a numeric field, or a date, you'll need to convert it prior to using this, such as the following numeric example with 0 decimals:

stringvar MyField:= totext({table.field},0,2);
replicatestring(" ",100-len(trim(MyField)))

The term you seek is a padded field, or the files are commonly referred to as space delimited files.

-k
 
Thanks synapsevampire, I really appreciate the help. It worked wonderfully.

Have a great day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top