Subject Re: [IBO] Lookup Doesn't work properly
Author Jose Ostos
Helen,
Thanks for your response.

I Tried exactly what you suggested (used a subquery on the PROVART table,
changed the KeyDescLinks, and specified widths on the lookup table) for the
sake of testing, but the result is still the same.

I am using the JOIN instead of the subquery because I need to be able to
sort de PROVART data grid by the description with the ability to do an
incremental search on it. The PROVART table is indeed an editable set since
I am using UpdateSql statements and the RequestLive=True property. I have
verified that I can edit, insert and delete records without problems.

As for the lookup grid, I have set the width of the data fields AND the grid
itself and I still have the problem. The strange thing is that it ONLY
happens the FIRST time I open the lookup grid, after that, it works without
any problems.

If it helps, I can upload or send you the screen images so that you can see
exactly what is happening.

Regards,
Jay



> At 05:37 AM 5/07/2005 +0000, you wrote:
>>I have a problem with a lookup combo that does not select the current
>>value of a record.
>>
>>The select statement of the data file is:
>>SELECT PROVART.PROV
>> , PROVART.CVEART
>> , INVE01.DESCR AS NOMPROD
>>FROM PROVART
>>JOIN INVE01 ON PROVART.CVEART=INVE01.CLV_ART
>>
>>The keylinks of this query is:
>>PROVART.PROV
>>PROVART.CVEART
>>
>>The select statement of the lookup table (Art) is:
>>SELECT CLV_ART, DESCR
>>FROM INVE01
>>
>>The keylinks of the lookup table is:
>>INVE01.CLV_ART=PROVART.CVEART
>>
>>The KeyDescLinks is:
>>INVE01.DESCR=PROVART.NOMPROD
>>
>>The KeySource is: dProvArt
>>
>>I have a TIB_Grid of the provart table with a TIB_LookupCombo in it
>>called cbArt with the following properties:
>>DataSource = dArt
>>DisplayField = DESCR
>>CustomPopUp = grdArt
>>
>>The behaviour Ia am getting is the following:
>>
>>1) the PROVART grid display the code CVEART and the description
>>NOMPROD correctly.
>>2) When I click on the NOMPROD field on the grid, the lookup (arrow)
>>button appears and the field contents become <blank>, (blue) no text.
>>3) I click on the arrow button and a grid of the lookup table appears
>>with the values of the code (CLV_ART) and the description (DESCR),
>>but at the beginning of the table and not at the current value of the
>>PROVART table.
>>
>>I have dedicated HOURS at this and cannot get it to work right. What
>>am I doing wrong?
>
> Where you are going astray here is with the use of the join, which
> produces
> an non-editable set. Use a subquery instead :
>
> SELECT
> p.PROV,
> p.CVEART,
> (SELECT i.DESCR FROM INVE01 i
> WHERE I.CLV_ART = p.CVEART) AS NOMPROD
> FROM PROVART p
>
>
> >> The keylinks of this query is:
> PROVART.PROV
> PROVART.CVEART
>
> That will be OK provided the combination of PROV and CVEART is unique.
>
> >> The select statement of the lookup table (Art) is:
> SELECT CLV_ART, DESCR
> FROM INVE01
>
> OK
>
> >> The keylinks of the lookup table is:
> INVE01.CLV_ART=PROVART.CVEART
>
> OK
>
> >> The KeyDescLinks is:
> INVE01.DESCR=PROVART.NOMPROD
>
> No. You can't refer to a virtual field like it was a real database
> field. KeyLinks will need to be:
> DESCR=NOMPROD
>
> >> The KeySource is: dProvArt
>
> The KeySource should be the tib_datasource that is being pointed to by the
> KeySource dataset.
>
> So, as far as I can see, it's really just a couple of small mistakes:
>
> 1) trying to use a non-editable set for what is purely an editing
> operation
> and
> 2) trying to link a virtual field to a database field.
>
> >> Another quirk is that the first time that I open the lookup grid, it
> appears very narrow. If I close it and open it again, it appears with
> the correct width but still not at the value of the data.
>
> In IBO, data drives controls, not the other way around. Set your grid
> fields (i.e. the column(s) visible in the drop-down portion) using
> FieldsDisplayWidth; however, you can set the physical width of the
> editbox
> part of the control (which is not a grid) using the Width property.
>
> Helen
>
>
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
> InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
> papers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>
>
>
>
>
>