# Populate DropDown from dataset column

**URL:** <https://forum.inductiveautomation.com/t/populate-dropdown-from-dataset-column/1211>\
**Category:** Archived Topics\
**Created:** [July 10, 2009, 7:06pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-from-dataset-column/1211 "2009-07-10T19:06:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![david\_mccutchen](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@david\_mccutchen](https://forum.inductiveautomation.com/u/david_mccutchen)\
**Post date:** [July 10, 2009, 7:06pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-from-dataset-column/1211/1 "2009-07-10T19:06:55Z")

</div>

Is there a way to populate a dropdown from a dataset column?

---

<div class="post-metadata">

**Author:** ![TimE](https://avatars.discourse-cdn.com/v4/letter/t/ee59a6/32.png) [@TimE](https://forum.inductiveautomation.com/u/TimE)\
**Post date:** [July 10, 2009, 9:00pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-from-dataset-column/1211/2 "2009-07-10T21:00:43Z")

</div>

Yes. This is what I did for my project screen. I also set the “Polling Off” option.

`SELECT DISTINCT Line FROM Projects
ORDER BY Line`

---

<div class="post-metadata">

**Author:** ![david\_mccutchen](https://avatars.discourse-cdn.com/v4/letter/d/919ad9/32.png) [@david\_mccutchen](https://forum.inductiveautomation.com/u/david_mccutchen)\
**Post date:** [July 10, 2009, 9:26pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-from-dataset-column/1211/3 "2009-07-10T21:26:56Z")

</div>

I am looking to do this for an fpmi table dataset not an sql table

---

<div class="post-metadata">

**Author:** ![TimE](https://avatars.discourse-cdn.com/v4/letter/t/ee59a6/32.png) [@TimE](https://forum.inductiveautomation.com/u/TimE)\
**Post date:** [July 10, 2009, 10:03pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-from-dataset-column/1211/4 "2009-07-10T22:03:30Z")

</div>

Sorry about that. You could try yo iterate through the dataset using:

```auto
data.getValueAt(row,col)
```

and add to the dropdown dataset

---

<div class="post-metadata">

**Author:** ![nathan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@nathan](https://forum.inductiveautomation.com/u/nathan)\
**Post date:** [July 11, 2009, 12:31am UTC](https://forum.inductiveautomation.com/t/populate-dropdown-from-dataset-column/1211/5 "2009-07-11T00:31:42Z")

</div>

It seems like there should be an expression function to do that - but I don’t think it exists.

[This](http://www.inductiveautomation.com/products/factorypmi/usermanual/source/technical/expression/overview.htm#functions) describes expression bindings for single elements (such as binding a string to somewhere in a dataSet), but doesn’t address binding a single column (or row) dataSet to a larger one. I’ll add it as a feature request if there isn’t an elegant solution response in this thread.

You shouldn’t have to script for this one…

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [July 11, 2009, 9:24pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-from-dataset-column/1211/6 "2009-07-11T21:24:40Z")

</div>

Yeah there should be an extractColumn(s) expression function.

Your best bet right row is to use the Column Selector component from the Reporting Plugin. Bind it up like you want it and then make the column selector invisible.

---

<div class="post-metadata">

**Author:** ![cbabb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cbabb/32/49029_2.png) [@cbabb](https://forum.inductiveautomation.com/u/cbabb)\
**Post date:** [December 20, 2012, 2:57pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-from-dataset-column/1211/7 "2012-12-20T14:57:53Z")

</div>

[quote=“nathan”]It seems like there should be an expression function to do that - but I don’t think it exists.

[This](http://www.inductiveautomation.com/products/factorypmi/usermanual/source/technical/expression/overview.htm#functions) describes expression bindings for single elements (such as binding a string to somewhere in a dataSet), but doesn’t address binding a single column (or row) dataSet to a larger one. I’ll add it as a feature request if there isn’t an elegant solution response in this thread.

You shouldn’t have to script for this one…[/quote]

Did this or something like it ever make it into the product?

If not, I’m requesting it

---

<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:** [December 20, 2012, 4:37pm UTC](https://forum.inductiveautomation.com/t/populate-dropdown-from-dataset-column/1211/8 "2012-12-20T16:37:59Z")

</div>

We have stopped adding new features to FactoryPMI. It is possible to loop through a table’s dataset and create a new dataset from it that you can set on the dropdown list. I would do it on a propertyChange event handler of the table:[code]if event.propertyName == “data”:  
data = fpmi.dataset.toPyDataSet(event.newValue)  
newData = []  
header = [“Col1”, “Col2”]

```
for row in data:
    newData.append([row[0], row[1]])

event.source.parent.getComponent("Dropdown").data = fpmi.dataset.toDataSet(header, newData)[/code]
```
