Erroneous results when calculating with LargeInt fields
Hi,
Writing RAP code involving LargeInt fields went wrong resulting in wrong
values and also often AV.
This example resulted in wrong results for the Stock variable. Stock keeps
the VOORRAAD['VOORRAAD'] value when the if-condition is reached.
VOORRAAD['VOORRAAD'] and VOORRAAD['RESERVERING'] are both calculated fields
resulting in a LargeInt value.
procedure DetailBeforePrint;
var Stock : integer;
begin
Stock := VOORRAAD['VOORRAAD'];
Stock := Stock - VOORRAAD['RESERVERING'];
if ( Stock < 0 )
then Detail.Visible := True
else Detail.Visible := False;
end;
When I preview the report, going back to the design or calc tab resulted
often in an AV.
As a workaround I used:
var Stock : integer;
Reservering : integer;
begin
Stock := VOORRAAD['VOORRAAD'];
Reservering := VOORRAAD['RESERVERING'];
Stock := Stock - Reservering;
if ( Stock < 0 )
then Detail.Visible := True
else Detail.Visible := False;
end;
Using RB10.07 Ent, IBX and Delphi 7
Regards,
Jeroen R?ttink
Writing RAP code involving LargeInt fields went wrong resulting in wrong
values and also often AV.
This example resulted in wrong results for the Stock variable. Stock keeps
the VOORRAAD['VOORRAAD'] value when the if-condition is reached.
VOORRAAD['VOORRAAD'] and VOORRAAD['RESERVERING'] are both calculated fields
resulting in a LargeInt value.
procedure DetailBeforePrint;
var Stock : integer;
begin
Stock := VOORRAAD['VOORRAAD'];
Stock := Stock - VOORRAAD['RESERVERING'];
if ( Stock < 0 )
then Detail.Visible := True
else Detail.Visible := False;
end;
When I preview the report, going back to the design or calc tab resulted
often in an AV.
As a workaround I used:
var Stock : integer;
Reservering : integer;
begin
Stock := VOORRAAD['VOORRAAD'];
Reservering := VOORRAAD['RESERVERING'];
Stock := Stock - Reservering;
if ( Stock < 0 )
then Detail.Visible := True
else Detail.Visible := False;
end;
Using RB10.07 Ent, IBX and Delphi 7
Regards,
Jeroen R?ttink
This discussion has been closed.
Comments
Any news here?
Regards,
Jeroen.