# Create an auto look up box

**URL:** <https://forum.inductiveautomation.com/t/create-an-auto-look-up-box/939>\
**Category:** Archived Topics\
**Created:** [January 13, 2009, 8:24pm UTC](https://forum.inductiveautomation.com/t/create-an-auto-look-up-box/939 "2009-01-13T20:24:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DB2](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@DB2](https://forum.inductiveautomation.com/u/DB2)\
**Post date:** [January 13, 2009, 8:24pm UTC](https://forum.inductiveautomation.com/t/create-an-auto-look-up-box/939/1 "2009-01-13T20:24:41Z")

</div>

I need to create an auto look up box, the process would be as follows, you would type the first letter of a part number in a text box and a row selector would goto the first line in the table that starts with the value typed. Then the process would repeat for each value typed until correct row is found in the table.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [January 13, 2009, 11:41pm UTC](https://forum.inductiveautomation.com/t/create-an-auto-look-up-box/939/2 "2009-01-13T23:41:24Z")

</div>

Once you have a table with data to search through, add a text field to the window (the search field). Once added, uncheck the Defer Updates property so the component will fire changes while you type. Lastly, add a propertyChange script to the component (by right-clicking and selecting Configure Actions -\> select propertyChange) that is the following:`if event.propertyName == "text":
	search = event.newValue
	table = event.source.parent.getComponent('Table')
	data = fpmi.db.toPyDataSet(table.data)
	rowToSelect = -1
	count = 0
	for row in data:
		sourceStr = row[1]
		if sourceStr.startswith(search):
			rowToSelect = count
			break
		count += 1
	table.selectedRow = rowToSelect` The eighth line selects which column from the dataset you want as the source string (first column is 0, next is 1 and so forth). Hope this helps.
