Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003335 [JEDI VCL] 00 JVCL Components major always 2005-12-01 11:45 2006-01-21 08:26
Reporter marcgeldon View Status public  
Assigned To jfudickar
Priority normal Resolution fixed  
Status resolved   Product Version 3.00
Summary 0003335: Bug in TJvDBGridCSVExport during Export (with Bug fix)
Description Hello!

I've got the following problem: if I export a CSV file and tell the component to export the field names in the first line of the new CSV file (property ShowColumnNames = True), it creates a first line something like this:

FIELD1;FIELD2;FIELD3;FIELD4;FIELD5;

Seems to be correct. But it isn't. The last seperator ";" is wrong. Some programs expect a new field name now and then they throw an exception. Some others ignore that error in the CSV file.

I've fixed this issue. Have a look at the additional information. I hope someone can change this very quick in the CVS.


Best wishes,

Marc Geldon
(PRO IT SYSTEMS >>> www.proitsystems.de)
Additional Information +++ ORIGINAL SOURCE START (approx. line 982) +++
function TJvDBGridCSVExport.DoExport: Boolean;
var
  I: Integer;
  ARecNo, lRecCount: Integer;
  lBookmark: TBookmark;
  lString, lField: string;
begin
  FDocument.Clear;
  Result := True;
  try
    if ShowColumnName then
    begin
      lString := '';
      for I := 0 to FColumnCount - 1 do
        if FRecordColumns[I].Visible then
          lString := lString + FRecordColumns[I].ColumnName + Separator;
      FDocument.Add(lString);
    end;
+++ ORIGINAL SOURCE END +++

+++ NEW SOURCE START (changes are in for loop "I := 0 to FColumnCount) +++
function TJvDBGridCSVExport.DoExport: Boolean;
var
  I: Integer;
  ARecNo, lRecCount: Integer;
  lBookmark: TBookmark;
  lString, lField: string;
begin
  FDocument.Clear;
  Result := True;
  try
    if ShowColumnName then
    begin
      lString := '';
      for I := 0 to FColumnCount - 1 do
      begin
        if FRecordColumns[I].Visible then
          lString := lString + FRecordColumns[I].ColumnName;
        if (I <> FColumnCount - 1) then
          lString := lString + Separator;
      end;
      FDocument.Add(lString);
    end;
+++ NEW SOURCE END +++
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0008183)
marcgeldon (reporter)
2005-12-01 11:45

Additional information: this bug fix is running without problems and we use that stuff in an productive enviroment here.
(0008195)
nestor (reporter)
2005-12-04 18:16

New source seems to include a new bug: Separator will be added to "IString" even when FRecordCoolums[i] is not visible.
(0008196)
marcgeldon (reporter)
2005-12-05 09:03

that's correct. So the source should look like this:

++++ SNIP ++++
    if ShowColumnName then
    begin
      lString := '';
      for I := 0 to FColumnCount - 1 do
      begin
        if FRecordColumns[I].Visible then
        begin
          lString := lString + FRecordColumns[I].ColumnName;

          if (I <> FColumnCount - 1) then
            lString := lString + Separator;
        end;
      end;
      FDocument.Add(lString);
    end;
++++ SNIP ++++

So please don't forget to use this code snip here together with the one above.
(0008209)
marcgeldon (reporter)
2005-12-12 15:28

Bug with Bugfix. Can anybody add this to CVS?
(0008370)
jfudickar (developer)
2006-01-11 13:16

My fix looks like and is commited:

      for I := 0 to FColumnCount - 1 do
        if FRecordColumns[I].Visible then
          if lString = '' then
            lString := FRecordColumns[I].ColumnName
          else
            lString := Separator + lString + FRecordColumns[I].ColumnName;

Please give a short feedback if it works.

Greetings
Jens
(0008410)
jfudickar (developer)
2006-01-20 10:00

Changed again to:

      for I := 0 to FColumnCount - 1 do
        if FRecordColumns[I].Visible then
          if lString = '' then
            lString := FRecordColumns[I].ColumnName
          else
            lString := lString + Separator + FRecordColumns[I].ColumnName;

Waiting for a feedback;
(0008417)
marcgeldon (reporter)
2006-01-21 02:55

change from 01-11-06 did not work, because first line looked like this:

;;;FIELD1FIELD2FIELD3
(0008418)
marcgeldon (reporter)
2006-01-21 03:06

I've downloaded the snapshot from today and now it seems to work. If I find any other problems, I will create a new bug. I think this one here can be closed.
(0008419)
jfudickar (developer)
2006-01-21 08:25

Thanks for the info and sorry for the little bug between

- Issue History
Date Modified Username Field Change
2005-12-01 11:45 marcgeldon New Issue
2005-12-01 11:45 marcgeldon Note Added: 0008183
2005-12-04 18:16 nestor Note Added: 0008195
2005-12-05 09:03 marcgeldon Note Added: 0008196
2005-12-12 15:28 marcgeldon Note Added: 0008209
2006-01-11 13:16 jfudickar Note Added: 0008370
2006-01-11 13:16 jfudickar Assigned To => jfudickar
2006-01-11 13:16 jfudickar Status new => feedback
2006-01-20 10:00 jfudickar Note Added: 0008410
2006-01-21 02:55 marcgeldon Note Added: 0008417
2006-01-21 03:06 marcgeldon Note Added: 0008418
2006-01-21 08:25 jfudickar Status feedback => resolved
2006-01-21 08:25 jfudickar Fixed in Version => 3.10
2006-01-21 08:25 jfudickar Resolution open => fixed
2006-01-21 08:25 jfudickar Note Added: 0008419


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker