×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How do I create an export file with fixed width fields and leading 0's

How do I create an export file with fixed width fields and leading 0's

How do I create an export file with fixed width fields and leading 0's

(OP)
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?   

RE: How do I create an export file with fixed width fields and leading 0's

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
www.chelseatech.co.nz/pubs.htm

RE: How do I create an export file with fixed width fields and leading 0's

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close