04-14-2004, 07:24 AM
I want to export data with Crystal Reports.
The data is supposed to be separated by tabs.
Mats Nilssson Luleň Sweden
I've tried to use different format types.
crEFTCharSeparatedValues with chr(9) as CharFieldDelimiter and chr(0) as CharStringDelimiter.
Nothing comes out the way I want. The TabSeparated formats enclosure the strings with ":s and charSeparated will not accept my null character as delimiter. Is there any way to solve this?
04-14-2004, 07:43 AM
Well, this is a common annoyance with Cystal Reports, have you tried a combination like this:
crxReport.ExportOptions.FormatType = crEFTTabSeparatedText
crxReport.ExportOptions.CharFieldDelimiter = vbTab
04-14-2004, 07:57 AM
Yupp, that didn't work either.
If you export with dialogs you can choose an empty char as delimiter and it works just fine but not under runtime.
04-14-2004, 08:19 AM
Can you post the code you are using? Most of my export routines occur within automated VB Scripts...we have some clients that use the NT scheduler and I export data to text based files, queried smaller reports, etc. several times a day. When I need to export to a text based file I use the ttx definition. This can be opened in any Text editor and it does the job for me. Try this in your export options, I use numercial constants because if I have to use the code in WScript or another scripting language I can just carry it over:
Rept.ExportOptions.FormatType = 6
Rept.ExportOptions.DestinationType = 1
Rept.ExportOptions.DiskFileName = txtPath & txtName & "-" & fString & ".ttx"
04-14-2004, 09:00 AM
'Tried these as well.....
'crReport.ExportOptions.FormatType = crEFTTabSeparatedText
'crReport.ExportOptions.FormatType = crEFTCharSeparatedValues
'...in combination with different values for these
'crReport.ExportOptions.CharFieldDelimiter = vbTab 'chr(9)
'crReport.ExportOptions.CharStringDelimiter = vbNull 'chr(0)
crReport.ExportOptions.FormatType = crEFTTabSeparatedValues
crReport.ExportOptions.DestinationType = crEDTDiskFile
crReport.ExportOptions.UseReportDateFormat = True
crReport.ExportOptions.UseReportNumberFormat = True
crReport.ExportOptions.DiskFileName = sFileName
crReport.DisplayProgressDialog = False
When using the above code (same as you last posted I think) I get a tab separated file but the strings are delimited with double quotes. (The numbers are strings)
"015" "666" "1979" "10001" "22" "Rutiga"
What I want is this:
015 666 1979 10001 22 Rutiga
04-15-2004, 02:46 AM
Check this out:
This is a known issue and has been fixed in the most recent service pack.
04-15-2004, 06:12 AM
OK, good info to know. I actually export my text based files to .ttx format. I have never had an issue with double quotes, interesting. Of course, I always load the recent service packs, so that might be why. But, did you ever trying using the Crystal standard .ttx format instead of naming the file .txt? I realize that the file extension has nothing to do with the output of the file (a text file is a text file either way) but a .ttx file is a native Crystal extension and the Print Engine seems to work well with the extension.
Well, either way you have a solution.
04-15-2004, 06:19 AM
Yes I tried using native file extensions with the same poor results.
.csv for comma separated files and .ttx for tab separated files.
But with the sp installed everything runs smoothly now.
04-15-2004, 06:24 AM
Is this version 9 by chance?