Subject Re: IBOQuery and TDBLookupComboBox
Author paultugwell
--- In IBObjects@y..., "Jason Wharton" <jwharton@i...> wrote:
> Paul,
>
> Apologies for not answering this sooner but so far I have not
completely
> understood the nature of your problem.
> The monitor probably won't reveal much other than that the queries
are
> getting the right data from the server.
>
> Which version of IBO are you on?

4.2Fb - I got it a few weeks ago but have only now got round to
checking it out

> Would it be possible you could send me a working sample of your
problem?
>
> One thing to try, set the AutoFetchAll property to true on the
lookup
> datasets.

This is set as True

> How big are they?
>
> Regards,
> Jason Wharton
> CPS - Mesa AZ
> http://www.ibobjects.com
>
>

3 queries qyCatList, qySubCatList and qySalItem and 3 datasources
dsCatList, dsSubCatList and dsSalItem

qyCatList is SELECT CAT, etc... FROM CATEGORIES ORDER BY CAT - 15-20
records. Table CATEGORIES is
CAT VARCHAR(15) NOT NULL
...
PRIMARY KEY (CAT)

qySubCatList is SELECT SUBCAT FROM SUBCATEGORIES WHERE CAT = :CAT
ORDER BY SUBCAT - 0-10 records for each value of CAT. The datasource
property of qySubCatList is dsCatList. Table SUBCATEGORIES is
CAT VARCHAR(15) NOT NULL
SUBCAT VARCHAR(15) NOT NULL
...
PRIMARY KEY (CAT, SUBCAT)

qySalItem is SELECT ORDER_NO, LINE_NO, CAT, SUBCAT, etc... FROM
SALESITEMS WHERE ORDER_NO = :ORDER_NO - 1-50 records, linked to a
sales order header query via the header datasource

All 3 queries are opened when the program is opened in the order
qyCatList, qySubCatList, qySalItem.

2 TLookupComboBoxes cmbCat and cmbSubCat

cmbCat cmbSubCat
DataField CAT SUBCAT
DataSource qySalItem qySubCatList
KeyField CAT SUBCAT
ListField dsCatList dsSubCatList
ListSource CAT SUBCAT

Say there are 3 records in qySalItem
I1 CAT=A SUBCAT=SA
I2 CAT=B SUBCAT=SB
I3 CAT=B SUBCAT=SB

What seems to happen is as follows
1) Move from I1 to I2 in qySalItem
2) CAT displayed in cmbCat updates from A to B
3) IBO runs a query on qySubCatList where it tries to lookup the
value for cmbSubCat but using CAT=A, SUBCAT=B1 which fails because
there is no such record, therefore cmbSubCat displays a blank
4) qySubCatList is updated using CAT=B
5) Move from I2 to I3 - still does not display subcat correctly
because no lookup is performed

The only time when SUBCAT is displayed correctly is when the ORDER_NO
in qySalItem changes due to the sales header changing and the values
for the of CAT are unchanged, hence the values of SUBCAT in cmbSubCat
are correct and the lookup works.

I am using a copy of data that has been created in a live environment
over 3 years using BDE queries.

Hope this explains matters - if I need to send you a copy of the
program, I will have to extract it from the current 3.2Mb EXE first!