Hi Schlirgg,
The Java Snippet node operates row-wise. You only have access to the values in the current row (and some constants and variables), and you can only return a value for one column in the current row.
If you need to traverse the entire table, you could use one of the JPython Script nodes, or program your own node extension.
Regards,
Hi Schlirgg,
When using the Java Snippet node, you can iterate the columns by creating a collection of cells. Have a look to the Create Collection Column and Split Collection Column nodes. Within the Java Snippet node you can access this collection of cells, such as:
String[] strs = $AggregatedValues$;
String r = “”;
for (int i = 0; i < strs.length; i++) {
r += strs[i];
}
return r;
Note, the return value itself can again a collection (Java array), therefore the “Array Return” checkbox need to be selected. Hope this helps.
Best, Thomas
Please respect the topic of a forum thread.
You can always open your own thread with a fitting title and you will get an answer.
Anyways, to get some super market data you can get inspired by the Workflow 007003_AssoziationRules in the group "007_ModularDataGeneration" on the KNIME Example server.