Referring to any cell from a full data table in Java Snippet

Hi!
Within a Java snippet, I have been trying to calculate accumulative values of a certain variable (which is in the same table) based on certain criteria, including the date and time of the current row. This value is then intended to be saved in a new column at this row.
Now I understand that the Java snippet already runs on each row of the newly created column to execute the commands, but what I cant seem to do, is that within that one iteration, be able to iterate through the entire data table, check my criteria, and add up the values in the right rows to reach the accumulative value I want.
My easy question here is: is there an available syntax that will allow me within the Java snippet platform to refer to cells that are not within the row being computed currently, but in the full data table coming as input to the Java snippet? thanks in advance for the quick help.

Hi @bebeid,
Random Access on the whole table is not possible with the Java snippet node, as many nodes in KNIME it is build to support potentially very large tables which might not fit into your main memory.
You either try one of the following options though:

  • Use a scripting node that provides the full table, e.g. Python Script, R Snippet etc.
  • Your task sound like a GroupBy / Pivoting operation to me, you might find that these nodes already support the kind of aggregation you want to perform.
  • Create your own node using the KNIME SDK: https://github.com/knime/knime-sdk-setup

best,
Gabriel

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.