View Issue Details

IDProjectCategoryView StatusLast Update
0003335JEDI VCL00 JVCL Componentspublic2006-01-21 08:26
ReportermarcgeldonAssigned Tojfudickar 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.10 
Summary0003335: Bug in TJvDBGridCSVExport during Export (with Bug fix)
DescriptionHello!

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 +++
TagsNo tags attached.

Activities

marcgeldon

2005-12-01 11:45

reporter   ~0008183

Additional information: this bug fix is running without problems and we use that stuff in an productive enviroment here.

nestor

2005-12-04 18:16

reporter   ~0008195

New source seems to include a new bug: Separator will be added to "IString" even when FRecordCoolums[i] is not visible.

marcgeldon

2005-12-05 09:03

reporter   ~0008196

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.

marcgeldon

2005-12-12 15:28

reporter   ~0008209

Bug with Bugfix. Can anybody add this to CVS?

jfudickar

2006-01-11 13:16

developer   ~0008370

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

jfudickar

2006-01-20 10:00

developer   ~0008410

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;

marcgeldon

2006-01-21 02:55

reporter   ~0008417

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

;;;FIELD1FIELD2FIELD3

marcgeldon

2006-01-21 03:06

reporter   ~0008418

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.

jfudickar

2006-01-21 08:25

developer   ~0008419

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