Hi,
Is there a way to create a Java routine to operate on the entire table? Java Snippet is row wise (it operates on a single row at time).
Tks!
Hi,
Is there a way to create a Java routine to operate on the entire table? Java Snippet is row wise (it operates on a single row at time).
Tks!
Knime works row-wise on data, except if you are aggregating data.
Yes, Java Snippet is row-wise. Is there any other way to run a Java routine to process the entire table?
You could write your own node that first stores the table in some memory based data structure...
I was afraid of that answer...
I didn't say that, but you could create row-wise collections including all columns and group all rows into a single cell which is basically a collection of collections which you can then iterate in the Java Snippet (simple) node. This of course completely undergoes our memory management. For the Java Snippet (simple) this reads as:
Object[] o = $columnname$;
for (int i = 0; i < o.length; i++) {
Object[] w = (Object[]) o[i];
for (int j = 0; j < w.length; j++) {
// do something here
}
}
return ... ;
I had the same problem at some point and solved it by saving the table as csv file to disk. You can pass the filename to the java snippet node as string flow variable. If you then read the data from the dumped csv file to an array or an Arraylist in the java snippet node you have the complete data set available. Might be not very elegant but it worked for me.
Best,
Christian