Hub
  • Software
  • Blog
  • Forum
  • Events
  • Documentation
  • About KNIME
  • KNIME Hub
  • Nodes
  • Variable Expressions
NodeNode / Manipulator

Variable Expressions

KNIME Labs
Drag & drop
Like
Copy short link

This node provides the possibility to append an arbitrary number of flow variables or modify existing variables using expressions. For each variable that shall be appended or modified a separate expression is defined. These expressions can be simply created using predefined functions similar to the Math Formula and String Manipulation Nodes). Nevertheless there is no restriction on the number of lines an expression has and the number of functions it uses. This allows users to create their own complex expressions.
Additionally, intermediate results of functions or calculations can be stored within an expression by assigning them to variables (using '='). This allows that these results can be reused in different parts of the expression after they have been assigned (see Examples). Note: the names of these variables must be different to all of the predefined function identifiers. Otherwise an error will occur.
To change an expression of an output variable it has to be selected in the list of expressions. By selecting an expression the Expression Editor shows up and the user can modify the expression in the provided text area.
Available flow variables can be accessed via the provided method variable("varName"). For each expression the last computed instruction will be returned.

The syntax and grammar of the expressions are based on the Javascript Languange .

Examples:

  • 5*7+3

    will append a variable with the value 38.

  • v = variable("knime.workspace")
    substr(v, lastIndexOfChar(v,"/"), length(v))

    will create a variable containing the folder name of the KNIME workspace folder.

  • "a1"
    "a2"

    will create a variable with the value "a2", whereas

    a1 = "a1"
    a2 = "a2"
    a1

    will create a variable with the value "a1".

Node details

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

Extension

The Variable Expressions node is part of this extension:

  1. Go to item

Related workflows & nodes

  1. Go to item
    Column_Expressions_KNIME_TIPS
    knimetips > Public > Column_Expressions_KNIME_TIPS
  2. Go to item
    Using IF Switch
    bruno29a > Public > Forum > Using IF Switch
  3. Go to item
    Just Knime it 16
    Justknimeit-16
    Here´s my solution:
    ricardocareli > Public > JustKnime16
  4. Go to item
    DownloadFromWorkflowRepo
    julian.bunzel > Public > Small examples > DownloadFromWorkflowRepo
  5. Go to item
    KNIME_challenge16_solution
    Justknimeit-16 Justknimeit
    Challenge 16: Grouping Data into CSV Files Level: Easy Description: You were asked to spl…
    martinmunch > Public > KNIME_challenge16_solution
  6. Go to item
    KNIME_challenge2_solution_MMU
    martinmunch > Public > KNIME_challenge2_solution
  7. Go to item
    JustKnimeIt-Challenge 2
    elohbeck > Public > Write multiple CSV files to multiple folders
  8. Go to item
    justknimeit - 12 - Raffaello Barri
    lelloba > Public > Just Knime it! > justknimeit - 12 - Raffaello Barri
  9. Go to item
    Calculate number of weekdays and weekends of customer stay
    bruno29a > Public > Forum > Calculate number of weekdays and weekends of customer stay
  10. Go to item
    KNIME_challenge12_solution
    Justknimeit-12 Justknimeit REST
    Description: You have been working for a Life Sciences company for a month as a a data wr…
    martinmunch > Public > KNIME_challenge12_solution
  1. Go to item
  2. Go to item
  3. Go to item
  4. Go to item
  5. Go to item
  6. Go to item

KNIME
Open for Innovation

KNIME AG
Hardturmstrasse 66
8005 Zurich, Switzerland
  • Software
  • Getting started
  • Documentation
  • E-Learning course
  • Solutions
  • KNIME Hub
  • KNIME Forum
  • Blog
  • Events
  • Partner
  • Developers
  • KNIME Home
  • KNIME Open Source Story
  • Careers
  • Contact us
Download KNIME Analytics Platform Read more on KNIME Server
© 2022 KNIME AG. All rights reserved.
  • Trademarks
  • Imprint
  • Privacy
  • Terms & Conditions
  • Credits