Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Issue with TeeChart and changing field names

edited May 2005 in General
I found an issue that I wanted to let you know about. I created a report
with a TeeChart that pointed to a particular DBISAM table. Everything was
fine until I changed the field name. I assumed I could open the report and
just change instead I received an AV in unit ppChrtDB in method
TppCustomDBChart.RecordToPoint.

I was able to fix it by adding the following code (see part where it
contains SMP CODE):

procedure TppCustomDBChart.RecordToPoint(aDataPipeline: TppDataPipeline;
aSeries: TChartSeries);
var
liIndex: Integer;
liFieldCount: Integer;
lsFieldAlias: String;
lField: TppField;
lsXLabel: String;
lColor: TColor;
ldX: Double;
ldY: Double;
begin

ldX := 0;
ldY := 0;
lColor := clTeeColor;

{get the x-label}
if (aSeries.XLabelsSource <> '') then
begin
lsFieldAlias := aSeries.XLabelsSource;
lField := aDataPipeline.GetFieldForAlias(lsFieldAlias);
{ BEGIN SMP CODE }
if (lField = nil) then
lsXLabel := lsFieldAlias
else
lsXLabel := aDataPipeline.GetFieldAsString(lField.FieldName)
{ END SMP CODE }
end
else
lsXLabel := '';

Any way to fix this without changing your source? The rest of the method
appears to support if lField is nil.

Thanks.

SMP

Comments

This discussion has been closed.