Dear KNIMErs,
I am currently struggling with what I assume is an error in my JavaScript code in the Column Expressions Node.
This is my table:
I have a table that comes prefilled in certain rows from some upstream nodes, see screenshot below. Basically what I want to do is to check for the winning supplier (stored in a flow variable) and if the winning supplier is ABC and the cell so far is empty, then assign the value from the original column.
Here’s the table I start with:
And this is the JavaScript code, I have used in the Column Expressions Node:
if (column("assigned volume") !== "") {
column("assigned volume")
} else if (variable("var-winning-vendor") == "ABC" && isMissing(column("assigned volume"))) {
column("original value")
}
Basically I want the 90,000 from vendor DEF to be copied and pasted in the assigned volume column for Row2 and the 130,000 from vendor DEF for Row3.
As I am not very well versed in JavaScript, I think my “formula” is somehow wrong, but I couldn’t find a place to correct it.
Here’s the workflow (KNIME Hub):
example-for-column-expressions – KNIME Community Hub
Thank you in advance…
Phil