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

Creating an flat export file of exactly 380 chars wide 1

Status
Not open for further replies.

demchak

IS-IT--Management
Jun 29, 2001
36
US
I need to create a flat text file ,1 record per line no breaks or delimiters, that is 380 chars wide. Some fields are static others need to be drug in from the DB. I have two questions.

1. How do I tell crystal that I dont care about the page size because the output is going to a file(or at least trick it into letting me do 380 colums wide)

2. How do I limit a field to a certain number of chars,not size, wide so that the fields end up exactly next to each other when I export it to a text file?


I need the data to fill an exact amount of space every time. If the field is to long cut it off If there is not enough data in the field I need it to space fill whatever is left over. In the example below first/last name fields are 10 chars.

Example: John Biglastname 111223333

static data Lastname FirstName SS#
ThisIsStaticInfoBiglastnamJohn 111223333
 
Setup a Plotter printer, then when in Crystal select that as your printer.
I've always had to create formulas checking field length then fill with 0's or spaces; If length({field}) = 1 then 00000000 + {field}. I do this for each field required in the report.
I then inserted a text box to which I insert all of my formulas and any text (if applicable - sometimes I have hard coded values).

I always have a fixed length file.

Hope this helps,
Montana
 
Since you're just exporting, change your paper/printer driver/font as required to allow for enough space.

A massive amount of space is gained using the HP3500CPS driver, nets you about 48 inches of space to play in.

You have many ways to approach the 380 columns.

Create a padded/truncated formula for each field and dropping them into a text object (place a text filed on the report) is probably the simplest.

If a length of 10 is required, use the following:

If length(trim({MyTable.MyField})) < 10
// We'll pad it
{MyTable.MyField}+
replicatestring(&quot; &quot;, 10-(length(trim({MyTable.MyField}))))
else
// We'll take 10 characters
left({MyTable.MyField},10)

You'll need to do this for every field, just replcae the 10's with the desired length.

-k kai@informeddatadecisions.com
 
I've used a technique with an EDI file output that needed fixed column positions, where, rather than export a report file, I create a disk file using a set of UFL functions.

Chekc out the Disk Output function library on my web site at
Editor and Publisher of Crystal Clear
 
Bruce, nice UFL. I guess I missed that one when I was on your site before. I can definately see applications for this. Software Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Thanks everyone, especially synapsevampire, for the help. Ive got everything working great now. Couldnt have done it without this forum!!!
W
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top