0 ×
Executes a jRuby script, taking 2 input DataTables and returning 2 output DataTables. 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.

Options

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.

Script

$input_datatable_arr
Array of input data tables.
$num_inputs
Number of input data tables.
$in_data_0
The input DataTable containing all available input from input port 0.
$in_data_1
The input DataTable containing all available input from input port 1.
$output_datatable_arr
Array of output containers.
$num_outputs
Number of outputs.
$out_data_0
Output container housing the outgoing DataTable for output port 0. The same as $outContainer.
$out_data_1
Output container housing the outgoing DataTable for output port 1.
Example use to copy all input row of DataTable:
(0..1).each do |i|
  out = $output_datatable_arr[i]
  $input_datatable_arr[i].each do |row|
    out << row
  end
end
Example use to extend input rows by new columns:
  count = $in_data_0.length
  $in_data_0.each_with_index do |row, i|
    $out_data_0 << (row << Cells.new.string('Hi!').int(row.getCell(0).to_s.length))
    setProgress "#{i*100/count}%" if i%100 != 0
  end
Example use to create new DataTable from custom data:
  $in_data_0.each do |row|
    $out_data_0 << Cells.new.string(row[0].to_s.length.to_s)
  end

Input Ports

Icon
Table that the Ruby script will operate on.
Icon
No description for this port available.

Output Ports

Icon
Table containing the results of the Ruby script.
Icon
No description for this port available.

Best Friends (Outgoing)

Workflows

Installation

To use this node in KNIME, install Ruby Scripting Extension from the following update site:

KNIME 4.3

You don't know what to do with this link? Read our NodePit Product and Node Installation Guide that explains you in detail how to install nodes to your KNIME Analytics Platform.

Wait a sec! You want to explore and install nodes even faster? We highly recommend our NodePit for KNIME extension for your KNIME Analytics Platform. Browse NodePit from within KNIME, install nodes with just one click and share your workflows with NodePit Space.

Developers

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.