Subject Re: [IBO] Colors for IB_LookupCombo in an IB_Grid
Author Svein Erling Tysvær
At 22:29 07.02.2001 +1300, you wrote:
>Hi Svein
>I agree with you, your suggestion seems a natural thing to do. When
>IB_LookupCombo.DisplayField is set to COL01A the IB_LookupCombo does not
>appear in the grid when COL01 is selected.


>If you look at the Sample-Contact app the DisplayField is set to CON_TYPE
>and this is the column name of the target column in the target table not the
>source column for the dropdown box. In your words it is the field in the
>master table. I guess the reasoning is "display the target field when
>selected". In my examples setting IB_LookupCombo.DisplayField = GTable.COL01
>has no beneficial effect.

I took a quick look at the example, and you're right. The only difference I
can spot between this example and how I use IB_LookupCombos is that
ordering is set up. Maybe one can choose from which dataset to display?

>I am still missing something to make the LC work, inside or outside the
>IB_Grid. My code works when the linked column names are identical.

I've been very successful just following the Getting Started Guide, and had
few problems since I first got IB_LookupCombos working. And it works
regardless of whether the names match or not.

>I wonder if there needs to be a foreign key constraint between the two
>columns? The FAQ says this is required, but it is not required when the
>column names are identical. I have proven this. The GSG does not have the
>word "foreign" in it. (using Help Find). The CONTACT.GDB database also does
>not have a FKConstraint between the columns so the advice in Lars' FAQ
>article is too strong.

I don't use any foreign keys, but what's stored in the field of interest in
my "master" dataset is the primary key of the "lookup" dataset. Does that
differ from your situation?


>----- Original Message -----
>From: Svein Erling Tysvær <svein.erling.tysvaer@...>
>To: <>
>Sent: Wednesday, February 07, 2001 7:54 PM
>Subject: Re: [IBO] Colors for IB_LookupCombo in an IB_Grid
>> Hi Russell!
>> >However I may have found the source of the problem as either a
>> >misunderstanding on my part or a shortcoming in IBO.
>> As usual, it is a misunderstanding and not a problem with IBO (I haven't
>> found a real error yet). Your problem is DisplayField, it should be the
>> field of the lookup dataset, not the master. Set DisplayField to COL01A
>> any other column of your lookup dataset).
>> Set
>> At 13:53 07.02.2001 +1300, you wrote:
>> >Hello Svein
>> >
>> >I did as you suggested, set up a simple example and its IB_LookupCombo
>> >inside an IB_Grid works OK. I also read Lars George FAQ note on this
>> >and ensured I had implemented the points of his recipe. Still my App does
>> >not
>> >work
>> >
>> >However I may have found the source of the problem as either a
>> >misunderstanding on my part or a shortcoming in IBO.
>> >
>> >Start with table GTable supplying IB_Grid using IB_QUERY qrGTable and
>> >datasource dsGTable. GTable has column COL01.
>> >
>> >Insert IB_LookupCombo (LC) into IB_Grid and get its data from table
>> >column COL01A using IB_Query qrLCTable and dsLCTable.
>> >
>> >qrLCTable has KeyLinks as LCTABLE.COL01A=GTABLE.COL01 and KeySource as
>> >dsGTable.
>> >LC has DataSource as dsLCTable and DisplayField as COL01.
>> >
>> >Under these circumstances, when in the grid and the embedded LC is
>> >the displayed field is blank. But one can correctly select a value from
>> >drop down list and the value is accepted.
>> >
>> >Now rework table LCTable changing the name of the column from COL01A to
>> >COL01 and adjust the Delphi code accordingly. The blank field problem
>> >away.
>> >
>> >Now rework LCTable back to its original column name. The problem returns.
>> >
>> >Have I missed something about linking fields with different names?
>> >
>> >Otherwise the qrLCTable.KeyLinks is insufficient to link columns with
>> >different names.
>> >
>> >Regards
>> >
>> >Russell