Subject RE: [IBO] LookupCombo doesn't position correctly if values contain numbers
Author Michael L. Horne
Helen,

Thanks for your reply, sorry I didn't get back to you
until today. However, your comments while appreciated
do not apply to the problem.

1. You said that I needed to order the file.
- While I don't have an 'ORDER BY APVEN_COMPANY' in the sql
- there is a OrderingItems.Strings "Name=APVEN_COMPANY"
- which seems to accomplish the same thing.

2. You said that I needed to set SearchKeyByKey=True.
- That must be the default value for SearchKeyByKey
- because when I look in the Object Inspector the
- property SearchKeyByKey is True.

Since your suggestions where already implemented
I must return to my original conclusion that there
may be a bug in LookupCombo when the first values
start with numbers. My thought is that there may
be some "if" statement that does something like if
first letter <= "A" then don't search. Since it
seems to position to the correct record on the
second and third and forth ... letters.

I again include the code of the components:

object ibVendor: TIB_LookupCombo
Left = 88
Top = 178
Width = 305
Height = 21
Hint = 'Select Vendor'
DataSource = dsAPVendorLookupEdit
TabOrder = 8
AllowTimeout = False
AutoDropDown = True
ClearSelectionOnExit = True
DisplayField = 'APVEN_COMPANY'
DropDownWidth = -1
SeekNearest = True
ShowButton = True
end
object qyAPVendorLookupEdit: TIB_Query
DatabaseName = 'C:\Offroad\IB\ORInventory.gdb'
FieldsCharCase.Strings = (
'APVEN_COMPANY=UPPER')
FieldsGridLabel.Strings = (
'APVEN_ID=ID'
'APVEN_COMPANY=Company')
FieldsDisplayWidth.Strings = (
'APVEN_COMPANY=269')
FieldsVisible.Strings = (
'APVEN_ADDR1=FALSE'
'APVEN_ADDR2=FALSE'
'APVEN_CITY=FALSE'
'APVEN_STATE=FALSE'
'APVEN_ZIP=FALSE'
'APVEN_PHONE=FALSE')
IB_Connection = formIBData.cnMain
SQL.Strings = (
'select APVEN_COMPANY '
' , APVEN_ID'
' , APVEN_ADDR1'
' , APVEN_ADDR2'
' , APVEN_CITY'
' , APVEN_STATE'
' , APVEN_ZIP'
' , APVEN_PHONE'
'from apVendor')
KeyLinks.Strings = (
'APVendor.APVen_ID=Inv.Inv_SRR_APVen_ID')
KeyDescLinks.Strings = (
'apVendor.APVEN_COMPANY=xAPVEN_COMPANY')
KeySource = dsInv
OrderingItemNo = 1
OrderingItems.Strings = (
'Name=APVEN_COMPANY;APVEN_COMPANY desc')
OrderingLinks.Strings = (
'APVEN_COMPANY=ITEM=1')
Left = 298
Top = 3
ParamValues = (
'OLNK_APVEN_COMPANY=')
end
object qyInv: TIB_Query
CalculatedFields.Strings = (
'Completed char(1)')
ColumnAttributes.Strings = (
'INV_PROCFLAG=BOOLEAN'
'INV_SRR_SRR1000_FLAG=BOOLEAN=T,F'
'INV_SRR_SRR1000_VALUE=CURRENCY'
'INV_SRR_PRIORITY=BOOLEAN=T,F'
'COMPLETED=BOOLEAN=T,F')
DatabaseName = 'C:\Offroad\IB\ORInventory.gdb'
FieldsCharCase.Strings = (
'INV_CONDITION=UPPER'
'INV_DESCR=UPPER'
'INV_NOTES=UPPER'
'INV_PROCFLAG=UPPER'
'INV_CUSTOMER_NOTES=UPPER'
'INV_PART=UPPER'
'INV_WAREHOUSE=UPPER'
'INV_LOC1=UPPER'
'INV_LOC2=UPPER'
'INV_SRR_PART=UPPER'
'XAPVEN_COMPANY=UPPER')
FieldsGridLabel.Strings = (
'INV_ID=ID'
'INV_PART=SRR-Part'
'INV_WAREHOUSE=WH'
'INV_CONDITION=Cond'
'INV_DESCR=Description'
'INV_QTY=Qty'
'INV_AVG_COST=Avg Cost'
'INV_PRICE=List'
'INV_LOC1=Loc1'
'INV_LOC2=Loc2'
'INV_WHOLEPRICE=WholeSale'
'INV_RETAILPRICE=Retail'
'INV_WEIGHT=Weight'
'INV_ONORDER=OO'
'INV_ALLOCATED=Aloc'
'INV_NOTES=Notes'
'INV_CUSTOMER_NOTES=CustNotes'
'INV_SRR_PART=Part'
'COMPLETED=Comp')
FieldsDisplayWidth.Strings = (
'COMPLETED=20')
FieldsReadOnly.Strings = (
'COMPLETED=TRUE')
IB_Connection = formIBData.cnMain
SQL.Strings = (
'Select inv.*,'
' (select APVEN_COMPANY from apVendor'

' where inv.inv_SRR_APVen_ID = apVendor.APVEN_ID) as xAPVE' +
'N_COMPANY'
'from inv'
'where inv_part = :part')
OnCalculateField = qyInvCalculateField
DefaultValues.Strings = (
'INV_PROCFLAG=F')
GeneratorLinks.Strings = (
'Inv.Inv_ID=gen_Inv_id')
GetServerDefaults = True
KeyLinks.Strings = (
'INV.INV_ID')
PessimisticLocking = True
RequestLive = True
Left = 88
end
>
> >Hello,
> >
> >I have setup a TIB_LookupCombo to select vendors from
> >our vendor file. I have noticed that if the user
> >hits "A" for the first letter it doesn't move until
> >the second letter is hit. I think this is because
> >the first few vendor names in our file start with
> >numbers.
>
> No. Numbers in strings are just characters. Alphabetically,
> they precede
> other characters but there's nothing special about them.
> Your lookup set
> is in random order because you are not ordering it. The
> reason it doesn't
> move is because nothing is being done to move it.
>
> Read on....comments inline.
>
>
> >Examples:
> >
> >2ND STEEL USED
> >5 RIVERS
> >AAA COOPER
> >ADAMS EQUIP
> >
> >When first entering the LookupCombo if the user types
> >"A" the positioning doesn't change. If they had typed
> >"B" then it positions to the first vendor starting with
> >"B". I think this might be a bug in the LookupCombo.
>
> Or a lack of reading the help text for the TIB_LookupCombo properties?
>
> You need to set SearchKeyByKey if you want the search to
> follow a sequence
> of one or more keystrokes through the lookup set
> automatically; otherwise
> the user has to type in the whole sequence s/he wants to
> search for, e.g.
> 'AAA' and then hit Enter to initiate the search.
>
>
> >object ibVendor: TIB_LookupCombo
> > Left = 88
> > Top = 178
> > Width = 305
> > Height = 21
> > Hint = 'Select Vendor'
> > DataSource = dsAPVendorLookupEdit
> > TabOrder = 8
> > AllowTimeout = False
> > AutoDropDown = True
> > ClearSelectionOnExit = True
> > DisplayField = 'APVEN_COMPANY'
> > DropDownWidth = -1
> > SeekNearest = True
>
> When SeekNearest is true and SearchKeyByKey is false, this
> causes the first
> occurrence of the entered search string to be selected. By
> default, if the
> search string isn't found, the lookup's cursor will stop at the next
> nearest value, but it doesn't select it.
>
> > ShowButton = True
> >end
> >object qyAPVendorLookupEdit: TIB_Query
> > DatabaseName = 'C:\Offroad\IB\ORInventory.gdb'
> > IB_Connection = formIBData.cnMain
> > SQL.Strings = (
> > 'select APVEN_COMPANY '
> > ' , APVEN_ID'
> > ' , APVEN_ADDR1'
> > ' , APVEN_ADDR2'
> > ' , APVEN_CITY'
> > ' , APVEN_STATE'
> > ' , APVEN_ZIP'
> > ' , APVEN_PHONE'
> > 'from apVendor')
>
> Lookups are generally more effective if you order the lookup
> set by the
> KeyDescLinks value, i.e. ORDER BY APVEN_COMPANY.
>
> > KeyLinks.Strings = (
> > 'APVendor.APVen_ID=Inv.Inv_SRR_APVen_ID')
> > KeyDescLinks.Strings = (
> > 'apVendor.APVEN_COMPANY=xAPVEN_COMPANY')
> > KeySource = dsInv
>
> 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
>
>
>
>
>
>
>
>
>