Subject Re: [IBO] Re: Problem changing data in TIB_LookupCombo and TIB_Grid components
Author Helen Borrie
Phil,

At 03:14 PM 17/03/2003 +0000, you wrote:
> > I don't know - what kind of lookupcombo controls are they?
>
>I understand this - it is not the ProgramDescription column that I
>want to update. I want to update the field CP.ProgramID which is a
>column of the CaseProgram Table.

OK, your problem description made it appear that you expected to use the
ib_lookupcombo to update the ProgramDescription column.


> > Go back to the write-up on lookupcombos, and you will see that the
> > linkage is made from the primary key equivalent of the lookup set,
> > back to a polling key in the parent set.
>
>I think what I am not getting is the fundamental way TIB_LookupCombo
>works. Perhaps I can pose the question this way. . . .
>
>TDBLookupCombo has the properties Keyfield and ListField.
>
>As I understand it, the property TIB_LookupCombo.DisplayField would
>be equivalent to TDBLookupCombo.ListField.

No. Although there is no "equivalence" between dblookupcombo and
ib_lookupcombo, the DisplayField is the field which appears in the editbox
part of the ib control. There is no listfield, because the contents of the
drop-down list determine what appears in the list. This can be one field
or many: it depends on the Visible properties which you set in the lookup
dataset.

>So, what is the functional equivalent of TDBLookupCombo.Keyfield?

IB_ controls are not like the VCL data-aware controls. The lookup
relationship is set up in the lookup dataset, not in the control.

>I _think_ this is defined in the keylinks property of the TIB_Query
>component which is defined over the secondary (lookup table). Is this
>correct?

Yes, correct. You match the key column(s) of the lookup dataset with the
polling column(s) of the parent dataset's table, via "dual keylinks", e.g.

e.g. ProgramID=MyParentTable.ProgramID

For this to work, the KeySource property must be the ib_datasource that
points to the parent dataset.

You also have KeyDescLinks, which is optionally used where you want to
display e.g. a Description field in the lookupcombo's DisplayField and in
the grid, but your KeyLinks link the key columns (optional, but fairly
usual). You get the Description field (as you have done) by way of a
subselect, with an alias name. Then you use KeyDescLinks to link the
DisplayField to this expression column that shows in your parent grid in
lieu of the polling key --- however, two things are important with this:

1. the polling key must be present in the parent dataset (but can be, and
usually is, invisible)
2. you can't use KeyDescLinks *instead* of KeyLinks. When you implement
the link between the description and the subselected expression, you need
to have both.

I see that you solved the problem. Good. :-))

Helen