Ruby Snippet

Go to Product
Executes a small jRuby script. The main difference between this node and Ruby Script is that it operates with each row of input DataTable separately and returns a new row for output DataTable. A simple example script is included in the dialog's text window of the Script tab.

This node uses Ruby-wrapper. See knime.rb at ruby4knime

Also, you can include additional gems from an external jRuby installation. But before that do setup jRuby path in preferences.


Script output

Append columns to input table spec
If checked, the columns as given in the list are appended to the input table specification. The number of columns in the output table equals the number of input columns plus the number of columns as given in the list. If unchecked, the output table will have exactly the same number of columns as given in the list.
Column list
Specify the column name and type of all result columns. After adding a new column, click on the name or type to change its value.


Output container housing the outgoing DataTable for output port 0. This must be populated with rows by the script or else there will be no output from the node.
Current row of input DataTable.
Example use to copy all input rows of DataTable:
    row # Only row!
Example use to extend input rows by new columns:
    row <<'Hi!').int(row[0].to_s.length))
Example use to create new DataTable from custom columns[0].to_f).double(row[2].to_f - row[1].to_f)

Input Ports

Table that the Ruby script will operate on.

Output Ports

Table containing the results of the Ruby script.

Popular Successors

  • No recommendations found


This node has no views




You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.