showing column metadata before executing a node

is it possible to have my node's config dialog get the input table spec so I can present the names of the columns to the user in a list for them to select BEFORE the node is executed ?

I'm guess that there isn't knowledge of the input table inside my NodeDialogPane class so if I cannot do this would I be ok to present a dialog as part of the execute method of the nodemodel or will this cause behaviour/threading problems ?

Hi,

Your node dialog will get the spec of the input table(s) in the NodeDialogPane.loadSettingsFrom method. Almost all of our nodes use this information, so there is no magic behind it :wink: But keep in mind, that some nodes cannot create a table spec before they are fully executed, they will report an empty spec to the successor nodes. Your dialog should be able to handle such cases by e.g. throwing a NotConfigurableException, preventing the dialog from being opened.

Regards,

Thorsten

Thorsten, many thanks for the information.
I now have access to the table specs from my own dialog by simply adding loadSettingsFrom method to my class.

Regards,

Mark.

I have a similar problem with a DefaultNodeSettingsPane.
I can read specs[] inside the below function, but the names-list is only filled
after the dialog is created, i.e. the user sees an empty list, where he
actually should have columns to choose between...
what's going wrong?

List names = new ArrayList();
...

public void loadAdditionalSettingsFrom(NodeSettingsRO settings,
DataTableSpec[] specs)
throws NotConfigurableException
{
for (int i=0; i<specs[0].getNumColumns(); i++)
{
System.out.println(specs[0].getColumnSpec(i).getName());
names.add(specs[0].getColumnSpec(i).getName());
}
}

Regards,
Martin

Hi Martin,

I'm not quite sure what you are trying to achieve with the code you posted, but here are some comments that may help already
It seems you want the user to choose a column name. Can you use the DialogComponentColumnNameSelection? It takes care of the update and the loading of the actual column names and all. All KNIME dialogs use this when a column selection is needed. It also displays the (type)icon of the column.
Now, if you still need to update/change a dialog component in the loadAdditionalSettings method, you should modify the SettingsModel used by the dialog component to change the actual set or selected value. If you need to update the selection list of a DialogComponentStringSelection, for example, you want to call replaceListItems(...) (but as I said, ColumnNameSelection is the way to go for column selection).

- Peter.