Populate DropDown from dataset column

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

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

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

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

data.getValueAt(row,col)

and add to the dropdown dataset

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

This 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…

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.

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

This 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

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]