Possibility to perform math operations

Hi there @Polestar01,

Welcome to KNIME Community Forum!

If you are a new user I recommend you to start with some tutorials on KNIME. There is Learning section on KNIME home page where you check E-Learning courses, KNIME Youtube channel, documentation and much more. Also there is KNIME Hub where you can search for nodes and example workflows which is a great way to learn KNIME. As you already discovered KNIME Community Forum is a place to ask questions, get help and share you knowledge. Feel free to contribute :wink:

Additionally if you are coming from Alteryx check out this forum topic for more information: Considering switching to KNIME from Alteryx

Now regarding your problem. If you want to use only one node Column Expressions is the node to use. It is based on JavaScript syntax so if you are not familiar with it check out some tutorial for it. I always have a look here for JavaScript help. You do not have to use Regex function for it as your syntax is pretty close. JavaScript is case sensitive so it is if and else without capital letters. Also as @izaychik63 said it is not one equal sing but rather two. So here is a syntax that should work:

if(column("column1") == "B") {
    column("column2")/3;
    }
    else {
    column("column2");
    }

If you do not want to use coding you can check out Rule Engine node. It can not perform arithmetic operations so you should use Math Formula node after it for example. I have created an example workflow so take a look.
2019_05_07_Rule_Engine&Math_Formula_example.knwf (12.0 KB)

Hope this helps!

Br,
Ivan

2 Likes