Java Snippet with two entries

Hello,

I want to do some code with java in my workflow,

So i want to get values from columns from two tables,each table is readed with xls reader node, and after i will write my code in the java snippet when i get all the columns.

Thanks.

Yes I'd like to know too!

Hello majdi, hello LM,

This depends very much on your task. The Java Snippet executes the given code on a per row base. I.e. the code is not aware of the other rows. This means that simply adding a second port to the Java Snippet would not solve that.

Some problems can be solved by using a Loop over the second table and feeding the row into the Java Snippet via a Table Row to Variable node.

Others can be solved using a Joiner or a Column Appender.

If this does not solve your problem, could you provide more information about what you want to do with the snippet?

Best,
Ferry

Hello ,

Thank you your reply,

the problem is that i want to add a column in my first file xls that contain the subject of project,but the subject of projects are in the second file.

Exemple :

this is a detailed project specification of  a project in the the first file: 

Les lymphomes primitifs du système nerveux central (LPSNC) sont des tumeurs « orphelines » (300 cas / an en France) et leur origine reste obscure car il n’existe pas de tissu lymphoïde connu dans le système nerveux central (SNC). De plus ce lymphome reste confiné dans le SNC (cerveau, moelle épinière, yeux, méninges) tout au long de la maladie sans métastaser au reste de l’organisme. Autre singularité, alors que l’immunodépression est un facteur favorisant connu (SIDA).

Now i will iterate all column 01 in the second file and if i found a string so the subject of project is in column02

is this case ,the subject is :Type cancer

Hello majdi,

You can do this without a Java Snippet!

The key to this is the NGram creator node from the Text Mining Plugin (under KNIME Labs). This node (in combination with a Strings to Documents node) gives you a list of substrings with length N. A neat Loop construction lets you construct all substrings with increasing length and then you just have to do a Cell Replacement to get the keyword for this phrase if there is one.

I know that this might not be that straightforward as using a Java Snippet, but trust me, you won't regret to build this workflow and if you need further guidance with it I'd be happy to assist.

Best,
Ferry