Subject | IB_Query OnCalculate Not firing? |
---|---|
Author | Kevin Stanton |
Post date | 2001-12-29T20:48:26Z |
Greetings,
I am just trying to migrate my app to D6 and IBO V4.2.Fn.
I have a grid that has two fields that are not showing and are defined in
GridLinks.
Relatedly, I have an IB_Query that the OnCalculateField does not seem to be
firing.
I have changed nothing in this area from D5 (IBO 3.6Cf) to D6.
Any help will be GREATLY appreciated.
Kevin
I don't even get the first line - ShowMessge dialog.
Help!
procedure TfrmPIInq.qryDtlOHCalculateField(Sender: TIB_Statement;
ARow: TIB_Row; AField: TIB_Column);
var
Wrk : Double;
TotCost, CPM : Currency;
CPMs : String;
PMFactor : Currency;
begin
ShowMessage('qryDtlOHCalculateField - ' + AField.FieldName);
If NOT Assigned(AField) then Exit;
If AField.FieldName = 'AVAILPCS' then
begin
If (ARow.ByName('CPIECES').IsNull = False) and
(ARow.ByName('CPIECES').AsString <> '') then
Wrk := ARow.ByName('CPIECES').AsFloat
else
Wrk := 0.0;
AField.AsFloat := ARow.ByName('PIECES').AsFloat - Wrk;
end;
If AField.FieldName = 'AVAILFTG' then
begin
If (ARow.ByName('CFOOTAGE').IsNull = False) and
(ARow.ByName('CFOOTAGE').AsString <> '') then
Wrk := ARow.ByName('CFOOTAGE').AsFloat
else
Wrk := 0.0;
AField.AsFloat := ARow.ByName('FOOTAGE').AsFloat - Wrk;
end;
If AField.FieldName = 'COSTPM' then
begin
TotCost := 0;
If ARow.ByName('WoodCost').IsNull = False then
TotCost := TotCost + ARow.ByName('WoodCost').AsCurrency;
If ARow.ByName('FrtCost').IsNull = False then
TotCost := TotCost + ARow.ByName('FrtCost').AsCurrency;
If ARow.ByName('ProcessCost').IsNull = False then
TotCost := TotCost + ARow.ByName('ProcessCost').AsCurrency;
If ARow.ByName('Interest').IsNull = False then
TotCost := TotCost + ARow.ByName('Interest').AsCurrency;
If ARow.ByName('Footage').IsNull = False then
Wrk := ARow.ByName('Footage').AsFloat
else
Wrk := 0;
{
If ARow.ByName('UOM').AsString = 'EA' then
PMFactor := 1
else
PMFactor := 1000;
}
PMFactor := ARow.ByName('PricingPer').AsCurrency;
If PMFactor = 0 then
PMFactor := 1000;
If ((Wrk <> 0) and (TotCost <> 0)) then
CPM := (TotCost / (Wrk / PMFactor))
else
CPM := 0;
Str(CPM:9:2, CPMs);
AField.AsString := CPMs;
end; // If AField.FieldName = 'COSTPM' then
end;
I am just trying to migrate my app to D6 and IBO V4.2.Fn.
I have a grid that has two fields that are not showing and are defined in
GridLinks.
Relatedly, I have an IB_Query that the OnCalculateField does not seem to be
firing.
I have changed nothing in this area from D5 (IBO 3.6Cf) to D6.
Any help will be GREATLY appreciated.
Kevin
I don't even get the first line - ShowMessge dialog.
Help!
procedure TfrmPIInq.qryDtlOHCalculateField(Sender: TIB_Statement;
ARow: TIB_Row; AField: TIB_Column);
var
Wrk : Double;
TotCost, CPM : Currency;
CPMs : String;
PMFactor : Currency;
begin
ShowMessage('qryDtlOHCalculateField - ' + AField.FieldName);
If NOT Assigned(AField) then Exit;
If AField.FieldName = 'AVAILPCS' then
begin
If (ARow.ByName('CPIECES').IsNull = False) and
(ARow.ByName('CPIECES').AsString <> '') then
Wrk := ARow.ByName('CPIECES').AsFloat
else
Wrk := 0.0;
AField.AsFloat := ARow.ByName('PIECES').AsFloat - Wrk;
end;
If AField.FieldName = 'AVAILFTG' then
begin
If (ARow.ByName('CFOOTAGE').IsNull = False) and
(ARow.ByName('CFOOTAGE').AsString <> '') then
Wrk := ARow.ByName('CFOOTAGE').AsFloat
else
Wrk := 0.0;
AField.AsFloat := ARow.ByName('FOOTAGE').AsFloat - Wrk;
end;
If AField.FieldName = 'COSTPM' then
begin
TotCost := 0;
If ARow.ByName('WoodCost').IsNull = False then
TotCost := TotCost + ARow.ByName('WoodCost').AsCurrency;
If ARow.ByName('FrtCost').IsNull = False then
TotCost := TotCost + ARow.ByName('FrtCost').AsCurrency;
If ARow.ByName('ProcessCost').IsNull = False then
TotCost := TotCost + ARow.ByName('ProcessCost').AsCurrency;
If ARow.ByName('Interest').IsNull = False then
TotCost := TotCost + ARow.ByName('Interest').AsCurrency;
If ARow.ByName('Footage').IsNull = False then
Wrk := ARow.ByName('Footage').AsFloat
else
Wrk := 0;
{
If ARow.ByName('UOM').AsString = 'EA' then
PMFactor := 1
else
PMFactor := 1000;
}
PMFactor := ARow.ByName('PricingPer').AsCurrency;
If PMFactor = 0 then
PMFactor := 1000;
If ((Wrk <> 0) and (TotCost <> 0)) then
CPM := (TotCost / (Wrk / PMFactor))
else
CPM := 0;
Str(CPM:9:2, CPMs);
AField.AsString := CPMs;
end; // If AField.FieldName = 'COSTPM' then
end;