CSV Export

edited 8:14AM in FastReport VCL 5
Hi All ,

This is probably really simple , I have 3 pages on a Report , First two are for general viewing by the user a Summary and then all the raw data , The third is a CSV export of the Master Data , I pass a parameter in the report string eg (Warehouse\BMS-Customer-Revenue.fr3&rCompID=%s&rCustCode=%s&rWkEnd=%s&rState=%s&rCSV=%s) Where rCSV = 1 to hide the pages not required ( IS this correct ?)

ON the procedure frxReportOnStartReport(Sender: TfrxComponent); I do the below;

if <rCSV> = 1 then
begin
SummPage.Visible := false;
DetailPage.Visible := false;
csvData.visible := true;
end
else
begin
SummPage.Visible := true;
DetailPage.Visible := true;
csvData.visible := false;
end;

I also set the following ( Delphi 2009)

if PrepareReport then
begin
DataForm.frxCSVExport.DefaultPath := 'C:\Temp\' ;
DataForm.frxCSVExport.FileName := 'csvtest.csv';
DataForm.frxCSVExport.Separator := ',';
DataForm.frxCSVExport.ForcedQuotes := true;
DataForm.frxCSVExport.ShowDialog := false;
DataForm.frxCSVExport.ShowProgress := true;
DataForm.frxCSVExport.ExportNotPrintable := false;
frxReportClient1.Export(DataForm.frxCSVExport);
end;

The resultant file that is exported has an excess of Separators ? I have all the fileds aligned to baLeft and Autosize set to true , also clipped - any suggestions would be appreciated

"Depot",,"DGL Ref",,"Cust-Ref",,,,,,"Product",,"Service",,"Description",,,,,,,,,,,,"Qty",,,,"Amount",,,,,"GST",,,,,,,,,,,,,
"EAG","10930",,"30/06/2014 PD",,,,,,,,,"10768",,,,"006.D",,,,,,,,"DOCKET ADMIN FEE",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1",,,,,"6.04",,,,,,,,,,,"0.604",,,,,,,
"EAG","10930",,"30/06/2014 PD",,,,,,,,,"MIN CHARGE",,,,,,,,,,,,,,,"JOBMIN",,,"MINIMUM JOB FEE",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1",,,"13.17",,,,,,,"1.317",,,
"EAG","10930",,"30/06/2014 PD",,,,,,,,,"10768",,,,"002",,,,,"HANDLING OUT",,,,,,,,,,,,,,,,,,"1",,,,,"3.71",,,,,,,,,,,"0.371",,,,,,,,,,,,,,
"EAG","11003",,"S 12983",,,,,"MIN CHARGE",,,,,,,,,,,,,,,"JOBMIN",,,"MINIMUM JOB FEE",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1",,,"13.17",,,,,,,"1.317",,,
"EAG","11003",,"S 12983",,,,,"789/300",,,,,"001",,,,,,"HANDLING IN",,,,,,,,,,,,,,"1",,,,,"3.71",,,,,,,,,,,,"0.371",,,,,,,,,,,,,
"EAG","11008",,"WA 23696",,,,,,"MIN CHARGE",,,,,,,,,,,,,,,"JOBMIN",,,"MINIMUM JOB FEE",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"1",,,"9.46",,,,,"0.946",,,

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 8:14AM
    have you read the user manual chapter on report design considerations?
    misalignment between objects vertical or horizontal can cause many extra commas to be inserted
  • edited 8:14AM
    Thanks Gordk

    Yes read the manual and understand the alignment was critical , it is pretty touchy however , I did resolve the issue in a slightly different manor that will sort out the file regardless of the report that passes the "csv" data and got the result I needed

    Again thanks for the assist >

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.