Subject Re: [IBO] CalculatedField problem with MIDAS
Author Jason Wharton
I finally figured this out. It was actually quite easy to fix. When
packetsize is other than -1 it uses a different state to fetch records
called dsBlockRead. I didn't have this state recognized in the
etFieldData( ) method when a calc field was being determined.

Here is all that needs to be done:

function TIBODataset.InternalGetFieldData( Field: TField;
Buffer: Pointer ): boolean;
{ !!! Add dsBlockRead state to this condition !!! }
if State in [dsBrowse, dsEdit, dsInsert, dsCalcFields, dsBlockRead] then
if Assigned( ACalcBuf ) then
Inc( longint( ACalcBuf ), FRecordSize + Field.Offset );
Result := boolean( pchar(ACalcBuf)[0] );
if Result and Assigned( Buffer ) then
Move( pchar( ACalcBuf )[1], Buffer^, Field.DataSize );
Result := false;

Look in IBDataset.pas around line 2650.

Thanks for pointing this out!

PS. This is the last known MIDAS bug I have to resolve...

Jason Wharton
CPS - Mesa AZ

----- Original Message -----
From: "Dominique Van Roie" <Dominique@...>
To: <IBObjects@...>
Sent: Thursday, January 04, 2001 10:51 AM
Subject: [IBO] CalculatedField problem with MIDAS

> Hi,
> I found an other problem with IBOQuery caclulated fields when viewed
> a client DataSet.
> If you set ClientDataSet.PacketRecords to a positive number like 20, the
> caclulated fields are empty
> on the clientDataSet side but are ok on the IBOQuery side.
> All is ok if ClientDataSet.PacketRecords = -1 but I really prefer the
> incremental fetching
> I found that the calculated fields values are lost in
> procedure TDataSetProvider.InternalGetRecords
> ...
> DataSet.BlockReadSize := Count; // count is the
> ClientDataSet.PacketRecords
> ...
> end;
> As an attachment is a small .dpr reproducing the problem.
> You will have to adapt the path to employee.gdb (demo file comming with
> delphi)
> <<>>
> I made all my testing with the latest version of IBO :
> Does anybody know a fix or a workAround
> Thanks
> Dominique