Trim Table

This node trims rows of missing values from the start and end of the table, according to the settings. Consider the following table:
Col1 Col2 Col3
Row0 ? Foo ?
Row1 Hello Foo Bah
Row2 ? Foo ?
Row3 World ? Bah
Row4 ? Foo ?
Row5 ? ? ?
Selecting All columns in the node dialog, with both trim start and trim end options selected, and the trim behaviour set as 'Require All' will result in only Row1 being kept:
Col1 Col2 Col3
Row1 Hello Foo Bah

Only selecting the trim start option would result in Row1 to the end of the table being kept:
Col1 Col2 Col3
Row1 Hello Foo Bah
Row2 ? Foo ?
Row3 World ? Bah
Row4 ? Foo ?
Row5 ? ? ?
and only selecting trim end would result in Row0 and Row1 being kept:
Col1 Col2 Col3
Row0 ? Foo ?
Row1 Hello Foo Bah

Changing the trim behaviour to 'Require Any', with both trim start and trim end options selected, will result in Row0 to Row4 being kept:
Col1 Col2 Col3
Row0 ? Foo ?
Row1 Hello Foo Bah
Row2 ? Foo ?
Row3 World ? Bah
Row4 ? Foo ?

Selecting only Col1, with either trim behaviour selected (they are degenerate for a single column), will result in Row1 to Row3 being kept:
Col1 Col2 Col3
Row1 Hello Foo Bah
Row2 ? Foo ?
Row3 World ? Bah
NB - The missing value in Row2 is retained, as there is a row which passes the filter later in the table (Row3)
Node execution follows the following order in node progress
  1. Looking for first include row (Only if 'Trim Start' is selected) - The node is working from the start of the table, looking for the first row to include in the output
  2. Adding rows to table - The first row to be included has been found, and rows are now being added to the output table. This continues until the end of the table if 'Trim End' is not selected, or until a row failing the include filter is found
  3. Checking for further matching rows at end of table (Only if 'Trim End' is selected) - The node is now looking ahead in the table to see if any more rows should be added to the table after the current row, which failed the include filter. Progress per row is now 1/2 what it was above, as each row could need to be processed twice. Rows are added to a temporary table
  4. Merging temporary tables (Only if 'Trim End' is selected, and the previous stage found any further rows to add to the table) - The node is now adding the rows required to be kept from the temporary table to the output table. The remaining progress is divided equally amongst the actual number of rows to be added to the output from the temporary table

This node was developed by Vernalis Research (Cambridge, UK) . For feedback and more information, please contact knime@vernalis.com

Options

Column selector
Select the columns to be used for filtering
Trim Start
Should columns at the start of the table be removed if they fail the 'Trim Behaviour' setting?
Trim End
Should columns at the end of the table be removed if they fail the 'Trim Behaviour' setting?
Trim Behaviour
'Require All' only keeps rows at the ends of the table in which all the selected columns are not missing values. 'Require Any' is a softer filter, keeping a row if any of the selected columns are non-missing.

Input Ports

Icon
A table to filter

Output Ports

Icon
The filtered input table

Views

This node has no views

Workflows

  • No workflows found

Links

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.