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 Mike Lewis 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 create an export file with fixed width fields and leading 0's 1

Status
Not open for further replies.

AcctSolver

Technical User
Sep 27, 2003
28
0
0
US
I have a report with multiple fields on it. Each field is required to be a specified width upon export, whether it is text or numeric. All numeric fields are to have leading zeros to fill in the required field size of 9. All numeric fields must be multiplied by 100 so there are no decimals, nor may there be any commas. The final file is 256 characters wide, and is to be formatted, space delimited. That eliminates Excel as an in-between manipulator; it only goes to 240 characters. How do I get the text output to be an exact number of characters? How do I get the numeric output to be exactly 9 characters wide with leading zeros?
 
Our grid User Function Library lets you create an export file from within some formulas while the report is processing. You can pad the fields and create any text or delimited format you wish.

Editor and Publisher of Crystal Clear
 
For the number:

totext({table.number}*100,"000000000")

I'm not sure about text, but you could try:

if len({table.field})>=9 then
left({table.field},9) else
space(9-len({table.field}))+{table.field}

You would probably need to use a non-proportional font to retain the spaces. I'm just not sure whether spaces might get trimmed upon export--probably depends upon what you are exporting to.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top