Subject | Filter on Calculated field problem?? |
---|---|
Author | G. Allen Casteran |
Post date | 2002-07-29T05:39:07Z |
Help!
I have a query with several calculated fields and I want to filter on them.
The OnCalculatedFields event fires on teh query and the field value is
calculated.
Every time I get to the filter, the value of my calculated field is null. ??
Following the debugger into the IBO code came across this problem:
procedure TIBODataset.RecordFilter( ARow: TIB_Row; var Accept: boolean );
var
SaveState: TDatasetState;
begin
SaveState := SetTempState( dsCalcFields );
try
Move( ARow.RowBuffer^, TempBuffer^, RecordSize );
CalculateFields( TempBuffer ); // THIS CALCULATES MY FIELDS
except
Application.HandleException( Self );
end;
RestoreState( SaveState ); // THIS WIPES OUT MY CALCULATIONS
SaveState := SetTempState( dsFilter );
try
Accept := true;
FFilterBuffer := TempBuffer;
OnFilterRecord( Self, Accept ); // BEFORE THIS Filter can
examine them. :(
except
Application.HandleException( Self );
end;
RestoreState( SaveState );
end;
Bug??
Thanks,
Allen
I have a query with several calculated fields and I want to filter on them.
The OnCalculatedFields event fires on teh query and the field value is
calculated.
Every time I get to the filter, the value of my calculated field is null. ??
Following the debugger into the IBO code came across this problem:
procedure TIBODataset.RecordFilter( ARow: TIB_Row; var Accept: boolean );
var
SaveState: TDatasetState;
begin
SaveState := SetTempState( dsCalcFields );
try
Move( ARow.RowBuffer^, TempBuffer^, RecordSize );
CalculateFields( TempBuffer ); // THIS CALCULATES MY FIELDS
except
Application.HandleException( Self );
end;
RestoreState( SaveState ); // THIS WIPES OUT MY CALCULATIONS
SaveState := SetTempState( dsFilter );
try
Accept := true;
FFilterBuffer := TempBuffer;
OnFilterRecord( Self, Accept ); // BEFORE THIS Filter can
examine them. :(
except
Application.HandleException( Self );
end;
RestoreState( SaveState );
end;
Bug??
Thanks,
Allen