Page 1 of 1

Export to CSV

Posted: Wed Mar 05, 2008 5:03 pm
by AndyA
I have a VB6 application that allows a user to send a report to the printer, the screen, or a file. ____Since Microsoft deprecated support for WKS files, I have developed an interface that allows mu users to select a CSV file. What the VB6 file does is to save the file as a TXT file, then the interface (VB.NET 2005) will convert the TXT file to a CSV file.____I know that seems a roundabout way to save a CSV file that R&R (version 9.09) writes, but the problem is the files do not come out as I expect.____I can run a RSW file an R&R and the formatting is correct in the resultant tab delimited file. Running the same file using the CSV export functionality, the report does not come out correct. ____Exporting as a tab delimited from the R&R designer, I get results like this:__unit_price_units_rev_gmpc_gmDOL___unit_price_units_rev_gmpc_gmDOL___$49.99_41_$2,050_56.0%_$1,148_($203)___$39.99_0_$0_0.0%_$0_$0___$27.99_63_$1,763_50.0%_$882_($253)_______Exporting as a CSV from the R&R designer, I get results like this:__unit_price,units,rev,gmpc,gmDOL__$49.99,41,$2,050,56.0%,$1,148,($203)__$39.99,0,$0,0.0%,$0,$0__$27.99,63,$1,763,50.0%,$882,($253____Exporting as a CSV causes rounding issues in the percentage fields. It does retain the formatting, but the problem is the numeric values that are greater than 999.99 have a comma added that causes the formating of the resulting Excel file to be off. For those reasons, I opted to go for the tab delimited option.____I was using the OCX to output the file, with a statement like this:__RSReport1.PrintFileName = FileNameToSave____This produces a file like this:__unit_price_units_rev_gmpc_gmDOL__49.99_44_2200_0.6_1226_293___49.99_41_2050_0.6_1148_-203___39.99_0_0_0.0_0_0_____I then tried using a Text Control File, using this as the shell command:__App.Path & " swrun.exe /TT" & App.Path & "" & ControlFile & " /CD" & gsDatabaseName & " /CU<UserName> /CP<Password>"____The control file that is used looks like the following:__RI_OUTFILE=C:Documents and SettingslandersonMy DocumentsCSV Test FilesPR_01.txt__RI_PRINTER=CSV__RI_REPORT=C:SourceSafeVBCodeReportReportTestinPROFIT_NOGROUP_PROD.rsw____The issue is I get an "Invalid command line argument" from the R&R SQL engine.____Does anyone have any suggestions?____Thank you in advance for your assistance.

=> RE: Export to CSV

Posted: Thu Mar 06, 2008 12:20 pm
by kfleming
My guess is that your command line has a space in it somewhere.____Try testing with explicit values rather than using variables.____Kathleen__R&R Support

==> RE: Export to CSV

Posted: Thu Mar 06, 2008 6:05 pm
by AndyA
You^re right. I had to do this in order to get it to work.__cmd$ = "C:SourceSafeMiscRRPrint swrun.exe" /TT"C:SourceSafeMiscRRPrintRR_ControlFile.txt" /CU"<UserName>" /CP"<Password>"