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

FIXED LENGTH fields, fixed length TEXT FILE output--in Crystal 8.5?

Status
Not open for further replies.

gal

Programmer
Mar 5, 2002
25
0
0
US
How does one export Crystal Reports 8.5 output to a text file with all FIXED-LENGTH fields? How would you PAD BLANKS TO THE RIGHT for a text field (e.g., zip code for 9 places)? How would you PAD ZEROES TO THE LEFT for a "numeric" field? (All fields are concatenated into one to avoid making a comma delimited file--will that work?)

Is there a way to link to only the first history record (to avoid extra detail records that get exported to the text file)?
 
You can use the following for text fields:

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

The above assumes you want a length of 10, adjust the 10 accordingly.

For a numeric, you can convert it to a string:

totext({table.field},"0000000000")

Adjust the number of zeros accordingly.

-k
 
I have found it best to do all the concatenation in one formula and end the line with a Chrw(10) for a Line feed.(The particular program I was using to import into required this). You then place this field on the report. I had tried placing several formulae into a text box on the report, but the result was not there.
I use V10 and have had issues in the past with the report dropping off trailing spaces on the lines - dependant on what monthly hot fix had been applied at the time. Currently as of Jan 2005 hot fix, its now working again. I can't recall wether I had the same issues with V8.5. Having said that you could still do the export as a rtf (with a bit of page break etc deleting in Word) and the trailing spaces would be there. Just means another step.
As far as the first history record goes it may be an issue with the way you have tables linked in your report - of which I am by no means an expert!. You may be able to suppress detail lines based on if the the key history field is the same as the previous record's.
Another thing I needed to do with my export report was to have a report header and a report footer dedicated to Header and trailer records for the export.
Hope this helps!
My previous thread on this was thread149-777275.

Regards,

Mark P
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top