How to determine whether a SettingsModel in a NodeModel is controlled by a flow variable?

Hi there,

how can I determine whether a SettingsModel in a NodeModel is controlled by a flow variable?

Example: SmilesDirectoryReader

  • If I enter nothing or a non-existing path into the dialog field "Directory", I will get a warning like Directory "z:\tmp2" does not exist -> that's ok and comprehensible
  • But, if I use a workflow variable that points to a non-existing location at configuration time, I will get the same warning.  In my opinion, in this case there should be no warning, because the variable value will probably change at execution time!

So, in my new node I am developing currently, I want to check, whether a SettingsModelXyz is filled by a constant value with some dialog component, or by a flow variable.

Thanks for any help, Frank

This is not possible. Flow variables are completely transparent to the dialog components (except if you program one yourself) and the settings. The final value will be injected into the NodeSettings object before loadValidatedSettings.

Hi thor,

although that is not the answer I would like to hear ;) ...

thank you very much for informing!

Best, Frank

If you are using a dialog component which takesa FlowVariableModel as an argument, then you can access the information - at least in the node dialog pane, with the FlowVariableModel#isVariableReplacementEnabled() and FlowVariableModel#getInputVariableName()

We use this a little in a node dialog - see the file PdbConnectorXmlQueryNodeDialog.java at https://community.knime.org/svn/nodes4knime/trunk/com.vernalis/com.vernalis.knime/src/com/vernalis/pdbconnector/ for an example.

But otherwise, as thor says, transparent!

Steve

Hi Steve,

thanks for this very valuable help!

And when reconsidering the tasks of a SettingsModel class, I think it's quite ok that one doesn't know the source where the stored information comes from in the NodeModel.

The NodeDialog is quite a good place to deal with this kind of meta-information.  Wasn't aware of this FlowVariableModel class.  And also many thanks for this source code link, great to just have a real example!

Best, Frank