Subject Re: [IBO] KeyDescLinks prevents OnDataChange from firing
Author Helen Borrie
At 05:21 PM 10/03/2005 +0100, you wrote:

>I'm working with IBO 4.3Aa and today I have discovered strange
>behaviour. I have a TIB_Query PCQuery, that selects the products with
>the select-statement:
>select PCID,
>PCMPID,
>(select MPNAME from MAINPRODUCTGROUPS where
> MPID=PRODUCTS.PCMPID) as MPNAME,
>PCNAME from PRODUCTS
>
>PCMPID is a foreign key, that points to the table MAINPRODUCTGROUPS.
>There is another TIB_Query MPQuery, that selects the Main-Productgroups
>with the select-statement:
>select MPID,
>MPNAME
>from MAINPRODUCTGROUPS
>
>The KeySource of MPQuery is assigned to the DataSource of PCQuery and
>the KeyLinks-Property of MPQuery is MAINPRODUCTGROUPS.MPID=PRODUCTS.PCMPID
>
>In the OnDataChange-Event of PCQuery I have the following code-snippet:
>if Assigned(Field) and (CompareText('PCMPID',Field.FieldName)=0) then
> ShowMessage('Main-Productgroup has changed');
>
>Now I run my test-app and change the value of MPQuery via a
>TIB_LookupCombo and the MessageBox pops up. That's the expected behaviour.
>
>Now I set the KeyDescLinks-Property of MPQuery to MPNAME=MPNAME
>and run the test-app again. When I change the value of MPQuery nothing
>happends and when I debug the test-app, I can see, that the
>OnDataChange-Events fires, but the field-parameter is always null.
>
>Am I doing something wrong or does IBO something wrong :-)
>
>Any help is appreciated.

Test whether using the full recommended syntax for KeyDescLinks changes the
behaviour: set it as PCQUERY.MPNAME=MPNAME. Also, make sure that the
table MAINPRODUCTGROUPS has no records with null in MPNAME, since the
KeyDescLinks matching won't match null to null.

Helen