Subject RE: [IBO] Locate key value AfterOpen
Author Alan McDonald
I think this is a matter of where you can assign the bookmark...
If, after the query is opened, and the grid is drawn with all current rows
visible (grid buffer is probably full) I then assign the saved bookmark
value to the query bookmark, I get the exact result I am after. The monitor
shows this sequence:
Fetch the record matching the bookmark.
Fetch individual rows after the bookmark value until the grid buffer is full
(below or after the value)
then return to the value above (before) the value and keep fetching records
less than the value until the grid is filled to the top. 20 lines visible in
the grid = 20 individual fetches - perfect.

Now I have jumped to the record in question, by a select to the server, and
filled the grid buffer rows by individual fetches. I have not just pulled
all the rows over to the client and looped down them till I find the record.

My big question, now, is: where is the IB_Query1.Bookmark := bmvalue
assigment intended to be placed. It certainly does not work in a query with
no other where clauses by assiging it in the AfterOpen event. The query has
to be fully opened and the grid buffers need to be full before this
assignment can take place. If you assign it in the afterOpen event the SQL
is hijacked and a single record is fetched only.

I'm still searching for the best place if anyone has a comment to make.
thanks
Alan

-----Original Message-----
From: Alan McDonald [mailto:alan@...]
Sent: Wednesday, 29 January 2003 4:28 PM
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Locate key value AfterOpen


Jason,
If I put
IB_Query1.Bookmark := qbmBlock;
in the IB_Query1 AfterOpen event (after storing the bookmark ro qbmBlock
previously)
and I have put the md.show call in the BeforePrepare event, then when the
query is opened, I can see the query statement as
SELECT FIELD1
, FIELD2
, ETC
WHERE PRIMARYKEY=?
where ?value is the bookmark.
Now when the form comes up, the grid is populated with only one row, the
bookmarked row.
Of course, an SQL statement like this is only going to bring back one record
but I am confused as to how setting the bookmark causes WHERE clause to be
inserted. I thought that setting a bookmark would do a seek on the already
opened query.

How do I set it up, such that the bookmark assignment does not confine the
query to one record?

thanks
Alan

-----Original Message-----
From: Jason Wharton [mailto:jwharton@...]
Sent: Wednesday, 29 January 2003 8:38 AM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] Locate key value AfterOpen


Not sure why there would only be one record.
Seems more details are needed.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com

-- We may not have it all together --
-- But together we have it all --


----- Original Message -----
From: "Alan McDonald" <alan@...>
To: <IBObjects@yahoogroups.com>
Sent: Monday, January 27, 2003 10:30 PM
Subject: [IBO] Locate key value AfterOpen


> I've been trying to get my methodology correct for this for quite some
> time - I seem to have come up against a brick wall.
>
> I've got an IB_ dataset working well in a IB_ grid. I can sort etc fine.
But
> I want to "locate" my users on the last record (keyvalue) they were on
(when
> exiting the application) each time they start the application again.
>
> I'm using the POS=0 syntax in the OrderingLinks.
>
> Without the POS=0 clause and using the
> IB_Query1.KeyFields.Values['BNO'] := irLastBlock; // registry integer
> IB_Query1.LookupKeyForFields;
> I locate the record in question without trouble but it seems (is) slow to
> get there.
>
> With the POS=0 clause, it is faster but the grid is left with only one
> record in it ( the record in question) and no apparent way to get all
> records visible (loaded).
>
>
> Does anyone have an idea as to what I'm missing?
> thanks
> Alan



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/




___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/