View Issue Details

IDProjectCategoryView StatusLast Update
0036385FPCPackagespublic2020-05-05 12:45
ReporterZdravko Gabrovski Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformallOSall 
Product Version3.3.1 
Fixed in Version3.3.1 
Summary0036385: fcldb - TCustomCSVExporter - DoDataHeader - Export all field captions, even those that Enabled = False
DescriptionThere is a small bug in procedure TCustomCSVExporter.DoDataHeader; , fpcsvexport, line 125.
Currently, missing a check if the field is enabled, it export all field names.

Current implementation:

procedure TCustomCSVExporter.DoDataHeader;

Var
  I : Integer;

begin
  If FormatSettings.HeaderRow then
    begin
    For I:=0 to ExportFields.Count-1 do
      begin
      FCSVOut.AppendCell(ExportFields[i].ExportedName); <------ Here must be changed
      end;
    FCSVOut.AppendRow; //close off with line ending
    end;
  inherited DoDataHeader;
end;

Must be:

procedure TCustomCSVExporter.DoDataHeader;

Var
  I : Integer;

begin
  If FormatSettings.HeaderRow then
    begin
    For I:=0 to ExportFields.Count-1 do
      begin
      If FExportFields[I].Enabled then // <- Change
        FCSVOut.AppendCell(ExportFields[i].ExportedName);
      end;
    FCSVOut.AppendRow; //close off with line ending
    end;
  inherited DoDataHeader;
end;

Steps To ReproduceAdd a TCSVExporter component, link it to your favor dataset, add two fields for export, and check "Enabled" property to first field to False.
In Format settings, Select "HeaderRow" property to "True".

After call the .Execute method, it will export the data only for the second field, but will export header for both fields.

TagsNo tags attached.
Fixed in Revision43639
FPCOldBugId
FPCTarget3.2.0
Attached Files

Activities

Michael Van Canneyt

2019-12-04 13:07

administrator   ~0119612

Fixed, thanks for reporting this !

Zdravko Gabrovski

2020-05-05 12:45

reporter   ~0122632

Fixed

Issue History

Date Modified Username Field Change
2019-11-30 17:13 Zdravko Gabrovski New Issue
2019-12-04 13:07 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-12-04 13:07 Michael Van Canneyt Status new => resolved
2019-12-04 13:07 Michael Van Canneyt Resolution open => fixed
2019-12-04 13:07 Michael Van Canneyt Fixed in Version => 3.3.1
2019-12-04 13:07 Michael Van Canneyt Fixed in Revision => 43639
2019-12-04 13:07 Michael Van Canneyt FPCTarget => 3.2.0
2019-12-04 13:07 Michael Van Canneyt Note Added: 0119612
2020-05-05 12:45 Zdravko Gabrovski Status resolved => closed
2020-05-05 12:45 Zdravko Gabrovski Note Added: 0122632