# Create Dropdown from one column of a table

**URL:** <https://forum.inductiveautomation.com/t/create-dropdown-from-one-column-of-a-table/8032>\
**Category:** Ignition\
**Created:** [February 20, 2014, 4:05pm UTC](https://forum.inductiveautomation.com/t/create-dropdown-from-one-column-of-a-table/8032 "2014-02-20T16:05:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbackus](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tbackus/32/5091_2.png) [@tbackus](https://forum.inductiveautomation.com/u/tbackus)\
**Post date:** [February 20, 2014, 4:05pm UTC](https://forum.inductiveautomation.com/t/create-dropdown-from-one-column-of-a-table/8032/1 "2014-02-20T16:05:11Z")

</div>

How do I create a dropdown list from just one column of an already populated table?

The table is returned to me as a stored procedure…

Columns: WorkOrderNum,StartDate,Priority,…

I just want to create a drop down that contains all the WorkOrderNum rows.

Is it possible? Yes I know I could have the Database guru change the SP but that takes an act of congress around here.

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [February 20, 2014, 4:37pm UTC](https://forum.inductiveautomation.com/t/create-dropdown-from-one-column-of-a-table/8032/2 "2014-02-20T16:37:14Z")

</div>

here is an example of taking a column out of a query and putting it into a dropdown. You would do pretty much the same on the returned result from your stored procedure.

`
query = "select devicename, displayname from devices where id < 10"
results = system.db.runQuery(query)
event.source.parent.getComponent('Table').data = results
print results
dropdownHeaders = ["Value", "Label"]
dropdownDS = []
i = 0
for row in results:
	i = i+1
	displayname = row[1]
	dropdownDS.append([i,displayname])
print dropdownDS
event.source.parent.getComponent('Dropdown').data = system.dataset.toDataSet(dropdownHeaders, dropdownDS)`
