bug in Java Snippet (simple)

Hi, :slight_smile:

Because I suppose it is a bug, so I just post here.

Here is the original table, total is my current money, cost is cost, remain = *current* total - cost. Super easy.

I want the result like this:

I use Java Snippet(simple) to solve this(init last_remain = -1 as a flag of first line):

The result is:

If I change the sample data to this, but use the same Java Snippet(simple), it works:

the remain column is right, isn’t it?
The only thing I need to do last it to use Math Formula node to re-calculate total.

knime 3.7.0

java_snippet_bug.knwf (24.1 KB)

Hi @HaveF,
this is caused by the missing values in the total column, you need to select the Insert Missing as Null option so that the node does not skip rows with missing values:

The node description for this option explains this behavior in more detail:

If selected, missing values in the input table will be represented by null in the expression. It is your responsibility to check for null in this case (…). If unselected, a missing value in the relevant input cell will immediately produce a missing output cell (snippet not called).



@Gabriel Thanks for your help. I did not read the doc.

Although I suppose it is a strange and misleading behavior :rofl:

Maybe the insert missing as null should be checked as default? Or some tips like snippet not called when meeting a missing value on the GUI would be great?

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