Subject RE: [IBO] KeyLiknks
Author Jason Wharton
> Dear Group,
> just a quick question about Keylinks, to understand if i'm
> making something faulty or not.
> While using a Keylink between two IB_Query (IB_Query1 Master
> and IB_Query2 Keylinked to IB_Query1) , the IB_Query2 is
> fetching the database taking a long time to get the record
> the first time is fired from IB_Query1, less while scrolling,
> but sometimes again is fetching the database. (Seems the
> first time is reading all the table like a locate, even is
> not checked AutoFetchAll).

The KeyLinks relationship keeps the dataset open with all records visible
and then the record pointer is moved based on what record is selected in the
referencing table. So, what is happening is it is performing a Locate() in
the dataset and making it appear to be doing a FetchAll.

What you can do to really speed this up and have it behaving more like a
Master-Detail relationship would is to modify the OrderingLinks property to
have the POS attribute set so that you will get the horizontal dataset
refinement behavior. What this does it it allows the dataset to be
virtualized and it will perform a seek to the record it wants immediately
and then if you want to scroll up or down in the dataset it will be
dynamically fetching in the records before or after it.

> While instead not linking together, but using a simply Query
> with Parambyname called after scrolling IB_Query1, IB_Query2
> is getting the record on he fly.
> Thanks for giving me some info on how to use correctly
> Keylink, since i'm sure i'm not using correctly.

You are using it correctly, just not understanding how to properly tune the
other options so that it works with optimum efficiency.

If you need more help configuring the OrderingLinks property feel free to
shout. It's not a topic that comes up very often so it would be good to
cover this again. This is one of IBO's really strong and unique points that
most people are unaware of.