Combo Box Filter Issues

Filed Under (Visual FoxPro, work.BLOG) by WildFire on 18-10-2004

Imagine you have a combo box.

This combo box holds (and displays) the 'NAME values' which are records in database F but returns the 'IDNO values'. (I'll explain the logic behind this on a different post... later.)

Database F contains only those two fields: the 'NAME values' which are mostly items/descriptions and its corresponding 'IDNO values' (or CODE or CODENUMBER whatever you prefer, lovely-lady-of-mount-lithsoma).

Now you 'morph' your combo box so that the text part would accept manual character entries and automatically filters the DropDown Items after its InteractiveChange event is triggered.

Now here's the question...

If the user types, let's say... the characters 'CHART', would you filter all the records having the string 'CHART' in it or just the records starting with the 'CHART' string?

In other words would you:

set filter to cBUFFER $ (upper(alltrim(DBASE.NAMEVALUE)))

... or would you:

set filter to cBUFFER $ substr(DBASE.NAMEVALUE, 1, nLEN)

... given that:

cBUFFER = upper(alltrim(this.Text))
nLEN = len(alltrim(cBUFFER))

Just some little issues I'm pondering on at 2:30 in the morning.

(And I am so tempted already to activate the comments feature of this blog.)