creating new field

Hi, I have to create a new field, derived from an existing one.
I have a column containing the following information
FIELD1
H501K
F236Y
Z199P
H201L
Z201W
I want to create the new FIELD 2 field with the following condition:
if the FIELD 1 field starts with Z then the field 2 field will be 1 otherwise 0
so then I’ll have this situation:
FIELD1 FIELD2
H501K 0
F236Y 0
Z199P 1
H201L 0
Z201W 1
Thank you all

nik80, welcome to KNIME forum.
You can use Column Expression for this task. You may need to install it.


The expression would be
if (indexOf($column(“FIELD1”, “Z” == 1)) {1}
else {0}

can’t I install nodepit? how can I do?

Do it regular way from Help/Install New Software…

Hi there @nik80,

welcome to KNIME Forum! Have you manage to solve your task? Install Column Expressions?

Additionally you can also use Rule Engine node in this case with following syntax:

$column1$ LIKE "Z*"=> 1
TRUE => 0

Br,
Ivan

1 Like

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