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!

Exporting Fixed Width Text File in Crystal X

Status
Not open for further replies.

CarolCook

IS-IT--Management
Mar 7, 2003
158
0
0
US
I have created all text fields of specific length padding them out with spaces using the REPLICATESTRING function as well as using a non-proportional font (Courier). I am using the HP DesignJet 3500 to get a report width of 100".

I am still not able to get the fields to populate the report with the exact width specified in the formula.

I have tried both creating each field individually, butting them up exactly against each other as well as creating one monster string with all the fields concatenated with little success. The monster string version seems to ignore all of the padding and the individual field version is still exporting all of the fields with their Crystal field 'box' width. There is a ton of data and the report is 801 characters long so trying to manually adjust the field width manually is not an option.

Thanks in advance for any tips!

Carol
 
If you want fields of a fixed width, create a single giant field in Crystal, a formula field that contains the others and spaces for padding.

You may also need to set a hgih value for 'dots per inch' when exporting to text.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Hi:

Tried both of those and neither worked. The single giant field (regardless of font) seemed to ignore all the spacing and resetting the characters per inch did not seem to have any effect.

I did ultimately solve the problem though. For whatever reason, exporting to Record Style (columns no spaces) ignores the rightmost field(s) if they are text boxes. When I replaced those with formulas containing the same text, they printed correctly. This did not hold for any text boxes within the rest of the report - just the rightmost.

Thanks for your response.
 
Carol,

I know this response is a little late...

What I did is created a formula called Filler1 with " " (one space) as the formula. Then within the giant field formula, I inserted the Filler1 formula between each of the fields. This worked for me.

Tracy
 
Tracy,

Thanks for the heads up. Will try this next time because right now am popping back and forth between a DOS editor to check the exact start and end position of each field in the text output. Labor intensive but works a treat. One question though, what do you do with exact field widths that have to butt against each other? Do you just leave the filler out?

BTW - just dug up this interesting fact - the max width on a text export is 25" so the best way to go is Columns no Spaces. The downside is that this format will not print the Report Header no matter what I try.

Carol
 
Export to text often seems to chop bits off. For that reason we developed some User Function Libraries that write to a disk file while the report is viewed. Works really well and doesn't have those limitations with the export format.
Download a trial version from our web site.

Editor and Publisher of Crystal Clear
 
Carol,

Yes, I just leave the filler out if the fields need to butt up against one another. Another thing I had to do, if the fields have the possibility of being null, then I made sure it prints spaces the length of that field, otherwise this will shift columns when you don't want them to.

This is my first time exporting the fixed width text also, so I'm still learning what's the best way to do it. Thank goodness for forums like these!!

Tracy
 
Tracy:
You can use the replicatestring function to automatically figure out how many blanks to prepend or append and join that to the field. Lets say the LASTNAME needs to be padded out to 25 characters. You want the formula to be

LASTNAME+replicatestring(" ",25-len(LASTNAME))

This will left justify the LASTNAME and pop as many spaces to the right as are needed to pad it out to 25. If you want the spaces before, juse reverse the order of the two pieces of the formula.
Carol

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top