Subject Re: [IBO] Lookup Combo in TIB_Grid
Author Helen Borrie
At 04:28 AM 3/05/2006, you wrote:
> > >I have tried to follow the Getting Started example of lookups in a
> > >TIB_Grid so it will use a LookupCombo for these fields. It just won't
> > >work for me. I'm using my own database, not the sample one, but
> > >otherwise I think I've followed the Guide precisely.
> > >
> > >The TIB_LookupCombo works as it should on my form, but after dropping
> > >it onto my grid, the column never appears, let alone with a ComboBox
> > >for selecting items.
> > >
> > >Any ideas?
> >
> > This is an editing mechanism. Is the main dataset live?
>
>I didn't see anything in the Getting Started Guide about setting any
>datasets "live". I'm just using it as the Guide explains.

OK, the embedded lookupcombo goes into action when the dataset is
"live", i.e. editable. (RequestLive=True for a simple query, or
using custom XxxxSQL for a joined or union or selectable SP set).

Considering that the purpose of the lookupcombo is to provide a
selection of values for *replacing* (editing) a value in an existing
column, or placing a value (in a row you are inserting), it's not
operational in a non-editable set.

> > When the set is live, the combobox should replace the polling
> > KeyLinks column,
>
>Polling KeyLinks column??? What does THAT mean?

I referred to it as "polling" because, in an editable dataset, the
column that is linked to the lookupcombo's set is polling the
keylinks of the linked lookup set. I purposely don't refer to this
polling column as a foreign key, since the lookupcombo's usage is not
restricted to FK's. In real life, though such linkages would be FKs
theoretically, in practice we avoid declaring them as such because
the low selectivity of the polling key kills performance.

>I am BRAND NEW to IBO. This is my very first try with it. I'm very
>familiar with IBX, but I don't know what you're talking about.

Understood.


> > the KeyDescLinks column if you're using that.
>
>Again, I'm using it just like the Getting Started Guide explains.
>Shouldn't that work?

Let's look at the main set. In the guide it's referred to as the
"Keysource set", because it is the one whose datasource you selected
as the KeySource for the lookup set. This would be your EMP_CODES
set, which should be sitting in the grid into which you plan to embed
the lookupcombo.


>Here's what I have. I have two main tables, EMPLOYEES and EMP_CODES,
>and seven lookup tables which are all linked to EMP_CODES.
>
>EMPLOYEES.KeyLinks: "EMPLOYEES.ID"
>
>EMP_CODES.KeyLinks: "EMP_CODES.ID"
>EMP_CODES.MasterSource: EMPLOYEES
>EMP_CODES.MasterLinks: "EMP_CODES.EMP_NO = EMPLOYEES.EMP_NO"
>
>EMP_CODES SQL includes the inline selects for the lookup fields
>
>LOOKUPS.KeyLinks: "LOOKUP.ID = EMP_CODES.LOOKUP_ID" (primary key,foreign key)
>LOOKUPS.KeyDescLinks: "LOOKUP.NAME = LOOKUP_NAME" (as designated in
>the inline selects in EMP_CODES SQL)

OK, but make sure that there are no spaces around the "=" signs.

>I place a TIB_LookupCombo on my form, beside the grid, and assign the
>DataSource property to one of my LOOKUP tables' DataSource. I set the
>DisplayField property to NAME. Compile and run, and the LookupCombo
>works exactly as it should.

You must also assign the KeySource property of the lookup set to the
datasource of EMP_CODES.

>In the EMP_CODES query, I have switched all the foreign-key columns
>(XXX_ID) Visible property to FALSE. The calculated fields, defined by
>the in-line selects, are all Visible=TRUE and the Column Attributes
>for each are set to COMPUTED, as the tutorial directs.

Fine.

>I cut (Ctrl-X) the LookupCombo from the form, select the TIB_Grid,
>paste (Ctrl-V) the LookupCombo onto the grid, change the form to text
>view and double-check that the LookupCombo is now contained by the
>Grid, change back to Form View, compile and run. No Combo on the
>LOOKUP column. The LookupCombo has simply vanished, and the grid
>behaves exactly as it did before.

Well, we know it's there, because you've checked the DFM. Now, all
that remains is to make EMP_CODES editable, and you should be there.

Helen