Board index » delphi » Blob access in OnCalc event

Blob access in OnCalc event

Hello one and all

* I have the following scenario:
Using Delphi 1 and Paradox databases I have a table containing a blob field
which is an array of floating point numbers. I would like to use these
values to display a single one of these (which value depends on other user
choices) in a grid. To accomplish this I create a calculated field and use
the OnCalc event to read the blob and fill in the field with the
appropriate value.

*and the problem is:
I cannot read the blob field from within the OnCalc procedure. The
TBlobStream Read() method returns 0 bytes.

*other info:
- Calling the same routine to read the blobfield from places other than
OnCalc works correctly.
- Looking at the VCL source for Delphi 2, the problem appears to be that
the TTable method GetCurrentRecord() called when creating the BlobStream
fails
- I cannot successfully call GetCurrentRecord from OnCalc either.

*and the solution is...

Wayne Schou
sch...@fri.cri.nz
New Zealand Forest Research Institute

 

Re:Blob access in OnCalc event


Wayne Schou <sch...@fri.cri.nz> wrote ...

Quote
> I cannot read the blob field from within the OnCalc procedure. The
> TBlobStream Read() method returns 0 bytes.

> *other info:
> - Calling the same routine to read the blobfield from places other than
> OnCalc works correctly.
> - Looking at the VCL source for Delphi 2, the problem appears to be that
> the TTable method GetCurrentRecord() called when creating the BlobStream
> fails
> - I cannot successfully call GetCurrentRecord from OnCalc either.

> *and the solution is...

... to obtain the Blob information from a second dataset component targeted
against the same table.  A table positioned via the GotoCurrent method or a
parameterized query would do.  

One warning though, the OnCalcFields event handler will not necessarily
fire for each record viewed if a multi-record component such as a DBGrid is
visible.

--
Roland Bouchereau

Other Threads