Subject Re: [IBO] Refresh / Buffer HowTo ?
Author Helen Borrie
At 05:04 AM 21/07/2005 +0000, you wrote:
>Thanks for your prompt reply.
>
>Do you have any code snippet of the
>InvalidateRowNum method ?

No. It's hardly worth a code snippet - it's just a procedure call.


>The Helpfile is not really helpful and I dont know
>where to get the aRowNum parameter or how to use it... :-(

The Helpfile is pretty helpful, I think. Since this in an inherited
method, you should read the TIB_Dataset help for InvalidateRowNum.

As for aRowNum, it is just an integer. You can read the RowNum property of
the current IB_Dataset to get a number to start with. You will obviously
have to do something with this number, in order to get an accurate mapping
between it and the RowNum of the InternalDataset of the iboquery. (That's
going to be the hard part, and one I can't advise you on, since you say you
are filtering the iboquery...but a place to consider looking at is the
KeyFields structures of the two queries...)

Let's suppose you find a way to make this mapping reliably by a function
call you name as GetOtherRowNum, then just use InvalidateRowNum in the
AfterPost of the ib_query to invalidate the corresponding row in the iboquery:

procedure MyDM.MyIB_QueryAfterPost(IB_Dataset: TIB_Dataset);
begin
MyIBOQuery.InvalidateRowNum(GetOtherRowNum(MyIBOQuery, IB_Dataset.RowNum))
end;

I see that the argument of TIBOQuery's InvalidateBookmark is a
TBookmarkStr, not a TBookmark, as I thought at first. The TDataset's
Bookmark property is a TBookmarkStr. According to the VCL help, an
application can read Bookmark to retrieve the bookmark associated with the
current record. You might be able to get at the row of the corresponding
IBOQuery row by applying the KeyFields of of the ib_query to a
TBookmarkStr, then using that to find the row with the matching Bookmark in
the IBOQuery, then call InvalidateBookmark on it.

This is all supposition as I have no idea how your iboquery set might map
to your ib_query set. I'm always happier working with bookmarks than with
absolute row numbers in a bi-directional dataset.

A reality check I didn't make when I first responded - I suppose the two
datasets ARE in the same transaction?

Helen