How to add a new row by Jython

I am try to make some statistics and want to write the output into a brand new table in a JPython Script 1:1 node. It should be a basic routine for many tasks. But I can not find any samples to tell me how to do it. Most samples told me how to modify the input rows and put them into outputContainer.

Is there any way to output a brand new table in jython?

I just want the following codes run:

row = ColumnRow([IntCell(0), IntCell(0), IntCell(0), IntCell(0)]) # Out put 4 columns.
outContainer.addRowToTable(row)

And is there some documents for the jython node in knime?

Thank you.

 


 

madlee,

For each row I declare an empty list with

forecast = []

then I append each cell value (iterating across my columns)

forcast.append(DoubleCell(load))

then I build a row with a ROWID and the list (forecast)

rowbuild = DefaultRow(loadrowkey,forecast)

and add it to the output table

outContainer.addRowToTable(rowbuild)

I've attached my full code to help if necessary. Note that I am using a Jython Script 2:1 but the principle is the same. I concur on the documentation shortage, I spent a lot of time trying to figure out the data structures in the Java documentation then figuring out how to manipulate them using Jython but eventually got there.

lclough

    Thank you. you are so kind. I will try it now. :)

madlee