Subject | Re: Fwd: Lookup Query keylinks problem |
---|---|
Author | Helen Borrie |
Post date | 2003-03-29T23:39:38Z |
At 11:11 PM 29/03/2003 +0000, you wrote:
Your problem stems from the fact that you are trying to implement a 1:1
master-detail relationship as a keysource-lookup and trying to make it work
both ways. K/L is exactly the reverse of M/D so you are looking at a
circular relationship here.
For K/L you must have:
-- a non-unique polling key in the parent (keysource) set
-- a unique responding key (keylinks) in the detail set
You use the K/L relationship to *write* a value from the lookup dataset to
the polling key
For M/D you must have:
-- a unique primary key in the parent (master) set
-- a unique or non-unique responding key (masterlinks) in the detail set
You use the M/D relationship to *select* a value for the foreign key of the
detail dataset.
You need to choose which you need (I think it is M/D) and implement it
accordingly. In short, K/L can't implement a master/detail relationship.
Helen
>--- In IBObjects@yahoogroups.com, "Marco Menardi" <mmenaz@l...> wrote:Marco,
>I've two tables, each that has records that must be distinguished by
>fiscal_year, and that are cloned every fiscal year, so the unique ID
>is in the form:
>FISCAL_YEAR + CODE
>i.e.
>2002 ABC
>2002 ADS
>2003 ABC
>2003 ADS
>
>well, in table A I have a field that has a lookup in table B, the
>lookup query.
>I've set a master-detail relation on the fiscal year, so in the B
>(lookup table) I've only the records of the same fiscal year of table
>A.
>The problem is that the B unique key is FISCAL_YEAR + CODE, so in the
>B table (lookup) I've to set KeyLinks in the form of:
>B.FISCAL_YEAR=A.FISCAL_YEAR
>B.CODE=A.LKP_CODE
>it works good but when I cancel a relation pressing CANC in the
>TIB_LookupCombo, of course A.FISCAL_YEAR and A.LKP_CODE are blanked,
>but A.FISCAL_YEAR is part of the primary key of A table, so I can't
>post!
>so I need:
>a) specify B.FISCAL_YEAR and B.CODE in keylinks of the lookup table
>b) don't specify B.CODE=A.LKP_CODE in the lookup table
>
>but this keylink:
>B.FISCAL_YEAR
>B.CODE=A.LKP_CODE
>does not work :( (I've a lookup list, but the lookup field remains
>always empty)
>
>how can I do?
>thanks
>Marco Menardi
>--- End forwarded message ---
Your problem stems from the fact that you are trying to implement a 1:1
master-detail relationship as a keysource-lookup and trying to make it work
both ways. K/L is exactly the reverse of M/D so you are looking at a
circular relationship here.
For K/L you must have:
-- a non-unique polling key in the parent (keysource) set
-- a unique responding key (keylinks) in the detail set
You use the K/L relationship to *write* a value from the lookup dataset to
the polling key
For M/D you must have:
-- a unique primary key in the parent (master) set
-- a unique or non-unique responding key (masterlinks) in the detail set
You use the M/D relationship to *select* a value for the foreign key of the
detail dataset.
You need to choose which you need (I think it is M/D) and implement it
accordingly. In short, K/L can't implement a master/detail relationship.
Helen