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

Exporting Report to Text 1

Status
Not open for further replies.

MPeacock

IS-IT--Management
Jul 3, 2002
13
AU
Hi,
I am having trouble with Crystal V10 exporting a subreport to text, while maintaining all trailing spaces. The resulting text file is used for importing to another program and must have the exact line composition or the import fails. Some lines have x number of spaces following the last data on that line. An export to text deletes all the trailing spaces. I can achieve the desired result by exporting in Rich Text Format - then opening in word and saving as text, but surely there must be a way to get it straight to text from Crystal.

Any ideas - Gurus?!

Regards,

Mark Peacock
 
Hello all,
I am experiencing a similar problem. Did you figure out a solution? Does anybody have any ideas on how to force some spaces to the end of a line?

Currently, my last formula field in a text box is:
Code:
stringvar spacestring := replicatestring(" ",30)+ chr(13);
spacestring;
This is just one of many different attempts and nothing has worked.

Thanks in advance for any assistance.

Darrin
 
Sorry Darrin - had no luck with the post and I am still using the method of exporting as a Rich text format file. Can anyone else help?

Regards,

Mark Peacock
 
Rich text is the correct format, but you must use a formula for each "fixed length" field. Following is an example:

If Length({ESYEMPLR.CITY}) < 20 then
{ESYEMPLR.CITY} + Space(20 - length({ESYEMPLR.CITY})) else
Left ({ESYEMPLR.CITY},20)

The above formula wants to output a City Name of exactly 20 characters. If the data field is less than 20, it takes the data field plus calc the needed spaces to = 20, otherwise it takes the first 20 characters of the data field.

I think this will do it for you.

MrBill
 
Thank you, MrBill for responding,
I have used those types of formulas for all of my other fields and this one is going to be the padding at the end. Does this mean that there is no way to export additional spaces at the end of a line without going to Rich Text?

Just curious, since that will be an added step to the process that we are attempting to automate.

Thanks again,
Darrin
 
Thanks for the response MrBill - the issue I had originally is that I just want a plain text file as a result, not a Rich text. As it currently stands, I need to export to the Rich Text, open in Word as Rich text and save as plain text (after some editing out of page breaks). Be great to cut out this step!

Regards,

Mark Peacock
 
It was quite a while ago that I figured out how to get fixed lenght fields to export. My notes say "rich text" and formula for trailing blanks. That is what worked for me and it is what I use.

Other formats may work, but I did not stumble across them.

Best of Luck,

MrBill
 
BigDarrin,
I believe I have resolved the issue. I had contacted Business Solutions support to pursue the issue, but also kept trying on my own. Although support was very prompt, I managed to work out that the export does not like to perform correctly from a Text object placed on the report. If you construct a formula field which basically does exactly the same as the concatenated entries in the Text box, and place that on the report it will respond correctly. I'm not sure what version of Crystal you have, but in V10 the correct coding for a ascii carriage return is:
Code:
Chrw(013)
I actually needed to place a line feed, which is ascii "010".
As long as the formatting and field heights are ok, this exported to text, and imported into my other app without any problems at all. Whoo-hoo!

Hope this helps!

Mark Peacock
 
Thanks Mark!
I haven't had a chance to try to implement this, but I look forward to finding out if it works. It sounds like it will.

Thanks again,
Darrin
 
I *finally* got around to using your suggestion and it worked!! Thanks for the heads-up and the valuable info to add to my Crystal Mental ToolBox.

Thanks again,
Darrin
 
Hi BigDarrin,
Have you been able to still export your text file correctly? For some time, even with the formula in place, I have been unable to export to text correctly. This appears to have coincided with a Crystal update I had installed. If you have also been affected you will be please to know that the latest update for dbex10win_en.zip has corrected the issue, using u2ftext.dll ver 10.0.5.596 15/12/04. This is available from:

ftp://ftp1.businessobjects.com/outgoing/EHF/dbex10win_en.zip

Hopefully this will stay functional for a while! Until they "fix" the program again anyway!

Cheers,

Mark
 
Does the CR or line feed count as a character?

Example: The line needs to have 184 spaces at the end. Would I use something like Space(183) + ChrW(013)?

Thanks.
Sheila
 
Hi Sheila and Mark,
First off, my report was for Crystal 8.5, but they seemed to have broken it with one of their fixes too. Thanks for the heads up though Mark.
And Sheila, again, in 8.5, the CR does not count as a character at least in my reports. I had one that had a needed line length of 300 bytes and the CR/LF were in 301 and 302 respectively. However, that may depend on the report specs.
I hope this helps a little bit.

Darrin
 
This seems to NOT work on version 9 also (formula field, with the length test and chr(013) at the end.) Has anyone a solution that works in 9?
 
I know I've seen some mentions of various fixes to text exports in Crystal 9.

If those don't solve the problem, a clean solution is to create a UFL that creates/appends content to a text file. You are then in full control over the content of the file. There are also 3rd-party UFLs listed at: and I'm aware of at least two that can do exactly that.

hth,
- Ido

Visual CUT & DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
IDO:
I just applied the March 2005 SP for CR9 and it still fails. Can you tell me the specific UFL(s) that work?

TIA,
Tim
 
solution: The monthly export hot fix did it!!

Crystal 9 Database and Export Drivers Monthly Hot Fix
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top