Hub
Pricing About
NodeNode / Manipulator

Rule Engine Variable

Workflow ControlVariables
Drag & drop
Like

This node takes a list of user-defined rules and tries to match them to the defined flow variables. If a rule matches, its outcome value will become the value of the flow variable. The first matching rule will determine the outcome.

Each rule is represented by a line. To add comments, start a line with // (comments can not be placed in the same line as a rule). Anything after // will not be interpreted as a rule. Rules consist of a condition part (antecedent), which must evaluate to true or false , and an outcome (consequent, after the => symbol) which is put into the new flow variable if the rule matches.

The outcome of a rule can either be a constant string, a constant number or boolean constant, or a reference to a flow variable value. The type of the outcome column is the common super type of all possible outcomes (including the rules that can never match). If no rule matches, the outcome is "", 0, or 0.0 depending on the output type.

Numbers are given in the usual decimal representation. Note that strings must not contain (double-)quotes (for those cases use the following syntax: /Oscar Wilde's wisdom: "Experience is simply the name we give our mistakes."/ ). The flow variables are represented by $${ TypeCharacterAndFlowVarName }$$ . The TypeCharacter should be 'D' for double (real) values, 'I' for integer values and 'S' for strings.

The logical expressions can be grouped with parentheses. The precedence rules for them are the following: NOT binds most, AND , XOR and finally OR the least. Comparison operators always take precedence over logical connectives. All operators (and their names) are case-sensitive.

Some example rules (each should be in one line):

// This is a comment
$${DFlowVar0}$$ > 0 => "Positive"
FlowVar0 has value above zero, which case the result flow variable has the value Positive.
$${SFlowVar0}$$ = "Active" AND 
    $${IFlowVar1}$$ <= 5 => "Outlier"
When FlowVar0 is "Active" and FlowVar1 is greater or equal to 5, then the result is Outlier.
$${SFlowVar0}$$ LIKE "Market Street*" AND 
    ($${SFlowVar1}$$ IN ("married", "divorced") 
        OR $${IFlowVar2}$$ > 40) => "Strange"
The logical connectives help express complex conditions.
$${SFlowVar10}$$ MATCHES $${SFlowVar0}$$ OR $${DFlowVar2}$$ < $${IFlowVar1}$$ =>
    $${SFlowVar0}$$
You can compare different flow variables.

You can use either Ctrl+Space to insert predefined parts, or select them from the upper controls.

The NaNs equal to other NaN values (other values are neither less, nor greater or equal to NaN values).

External resources

  • KNIME E-Learning Course: Creation and usage of Flow Variables in a KNIME workflow

Node details

Input ports
  1. Type: Flow Variable
    Input variables (optional)
    Input variables (optional)
Output ports
  1. Type: Flow Variable
    Output variables
    Output variables.

Extension

The Rule Engine Variable node is part of this extension:

  1. Go to item

Related workflows & nodes

  1. Go to item
  2. Go to item
  3. Go to item

KNIME
Open for Innovation

KNIME AG
Talacker 50
8001 Zurich, Switzerland
  • Software
  • Getting started
  • Documentation
  • Courses + Certification
  • Solutions
  • KNIME Hub
  • KNIME Forum
  • Blog
  • Events
  • Partner
  • Developers
  • KNIME Home
  • Careers
  • Contact us
Download KNIME Analytics Platform Read more about KNIME Business Hub
© 2025 KNIME AG. All rights reserved.
  • Trademarks
  • Imprint
  • Privacy
  • Terms & Conditions
  • Data Processing Agreement
  • Credits