Hi,

Sorry to be barraging the forums here with questions, but I figure this is probably the best place to ask.

Anyway, I am trying to compare two columns and produce a new column. Below is an example of what I am trying to accomplish.

rowID, billed_amount, paid_amount

1, 40, 40

2, 30, 20

3, 500, 250

I want to compare billed_amount and paid_amount to see if at least 50% of the bill was paid, if it was, I want it to say true in the new column, otherwise, false.

SC

Check out the Math Formula node or the Java Snippet node, both can help computing the ratio payed between both two values.

You can try several ways to do this:

1. Use a Math Formula node to create a new column which contains your billed amount / 2 (use the expression `$billed$/2.0`

) to generate a column to compare with. Follow this node with either a 'Rule Engine' node, to compare your 'paid' with your new 50pc billed column, or a 'Column Comparator' node to do the comparison (set the returned values to 'USER_DEFINED' in the dropdowns - the node is defaulted to then having true/false as the values

2. If you are comfortable with java, you can achieve it in a single 'Java Snippet' node, with the following expression, applied directly to your input table:

`String r = "";`

r = ($paid$>($billed$/2.0)) ? "True" : "False";

return r;

3. If you are happy to have 1 and 0 instead of "true"/"false", then a 'Math Formula' node with the expression

`if($paid$ > $billed$/2.0, 1,0 )`

will achieve this directly on your input table too. I've called the input columns 'billed' and 'paid' throughout.

Steve

Very good. I was able to accomplish my task. I didn't even realize that there was a Java snippet node. This really makes this tool easy to use. Thanks for both of your comments.

Hi:

Could you tell me where I can found that node? I was searching all Knime´s operators and I couldn´t find something like that. I need to do a quotient between two variables and I don´t know how to do it.

Thanks

Gabriel Cornejo.