Select a value from a certain column when developing a node

Hello everyone,
It’s easy to select a column from the Spec using
‘‘addDialogComponent(new DialogComponentColumnNameSelection(labelColumnSettings, “Label column:”, tableIndex, DataValue.class));’’
when building the dialog of a new node. That will be like:
image
in the dialog.

But how can we select a value from a selected column? Display all values for this column in the drop-down list, then select one.

Hi @Chen_Zhang,

You can get information from the column domain, be aware that domain information may not always be available.
Take a look at the implementation in the Logistic Regression Learner:

  1. store a reference to the input table spec:
    knime-base/LogRegLearnerNodeDialogPane.java at master · knime/knime-base · GitHub
  2. Implement the code to update the selection model based on the domain data:
    knime-base/LogRegLearnerNodeDialogPane.java at master · knime/knime-base · GitHub
  3. Don’t forget to add an EventListener to your column selection widget:
    knime-base/LogRegLearnerNodeDialogPane.java at master · knime/knime-base · GitHub

best,
Gabriel

2 Likes