I am using Lazarus 1.0.10 and FortesReport 3.24.LCLR2 on Win7-74 PC.
I connect to a MySQL db using TMySQL50Connection.
The SQL contains SUM(myMAQQty) AS qty, SUM(myMAQCost * myMAQQty) AS cost
The report has a detail field that shows 'cost'. This shows up correctly.
It also has a summary band that shows a TDBResult, iSum of 'cost'.
The output is always 0, which is incorrect.
However, the qty field (used in the details and summary bands, just like 'cost') shows correctly.
The qty field shows up (in the object browser) as a TFloatField, whereas the cost field shows up as TFMTBCDField.
Tracing it through RLReport.pas, shows that (in TRLCustomDBResult.ComputeDetail(), near line 8372) the call to VarIsNumeric() returns false for the cost field, which is of type TFMTBCDField.
If I change the code in RLReport.pas (near line 8372) from
if VarIsNumeric(fieldvalue) then
fSum:=fSum+fieldvalue;
to
var flt: float;
...
...
if VarIsNumeric(fieldvalue) then begin
fSum:=fSum+fieldvalue;
end else if TryStrToFloat(fieldvalue, flt) then begin
fSum:=fSum+flt;
end;
it works.
I should point out that this report worked fine with ODBC-->MSAccess.
It only started failing when I switched to MySQL v5.0
Has anyone else had any similar issues?