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

Having problems exporting to a character-separated file. 1

Status
Not open for further replies.
Dec 3, 2002
2
US
I have a report that I need to export to a character-separated file. I'm using a tilde for the delimiter. It has a Report Header and Footer and these need to be at the top and bottom of the file. Here's what comes out:

~position~~amsouth~20021204~000000000~~032168825~1~trailer
~position~~amsouth~20021204~000000000~~032168825~1~trailer
~position~~amsouth~20021204~000000000~~032168825~1~trailer

Here's what I want:

position~amsouth~20021204 (Header)
000000000~032168825~1
000000000~032168825~1 (Details)
000000000~032168825~1
trailer (Footer)

Two problems with what I'm getting.

1) There's delimmiters where there are no fields. Each record starts with a delimiter and there's two delimiters between "position" & "amsouth". This would seem to indicate Crystal thought there was a blank field before and after "position" and delimited accordingly but no such blank field exists.
2) The header & footer are showing up as fields in the details section.

If I export the report to Excel, everything shows up perfect.If I export out of Excel into comma delimmited file, everything shows up perfect. I tried exporting into other text formats out of Crystal and got varying degrees of flaky results.

Anybody have any ideas?
 
Found my own answer on the Crystal site:

Synopsis

A report created in version 8 of the Crystal Reports Designer was exported to CSV format. However, in the CSV file the page header information repeated for every record.

How can you format a report for export to CSV so the page header information appears only at the beginning of the CSV file?


Solution

To display the page header information at the beginning of the CSV file, replace the page header section with a group header that acts as a mock page header.

NOTE:======

This resolution requires the version 8.0.0.8 in CR 8 and 8.5 of the exporting DLL 'U2fsepv.dll'. In CR 9, changing the exporting DLLs are not required.

To verify your version of this file:

· Search the Windows\Crystal or Winnt\Crystal folder for 'U2fsepv.dll'.

· Right-click the filename, and then click 'Properties'. The 'Properties' dialog box appears.

· On the 'Version' tab, check the version number.

If you have a version previous to 8.0.0.8, contact Technical Support at (604) 669-8379 to obtain version 8.0.0.8.

============

1. On the 'Insert' menu, click 'Formula Field', and create these two formulas:

//@Fake PH

WhileReadingRecords;
1



//@False Group
WhileReadingRecords;
2

2. On the 'Insert' menu, click 'Group', and create a group based on the @Fake PH formula.

3. Insert a second group based on @False Group.

Make sure that group# 1 is based on @Fake PH, and that group#2 is based on @False Group.

4. Move the contents of the page header section into the group header #1 section (the @Fake PH group header).

The easiest way to move several objects from one section to another is to draw a lasso around the objects with your mouse to select them. Once selected, you can move them to another section.

5. On the 'Format' menu, click 'Section'. The 'Section Expert' dialog box appears.

6. In the 'Sections' list, select the page header section, and then select the 'Suppress' checkbox.

7. Repeat step 6 for the group footer #1, group header #2, and group footer #2 sections.

8. Click 'OK' to return to the report.


The next time you export the report, this formatting ensures there is only one header line at the beginning of the CSV file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top