String Manipulation/Classification via Rule Engine

Hey there KNIME Community,

I’m preparing Data to run an analysis and as so often, Data cleaning first!
I have a CSV with to many columns, so I used File Reader Node. Unfortunately the Discount column was matched as String and when I try to convert it to double via String to Number Node I just receive “?” as a value and some values in the original column can’t be parsed.

Now I tried the Rule Engine Node, but not all values are matched correctly.

The original column can contain:

-0.00%
5.00%

Via Rule Enginge:

$disc %$ = “-” => 0
$disc %$ = “-0*” => 0
TRUE => 1

Result:
“-” and 5.00% get classified correct with 1, but “-0*” not.

How do I get this “-0[don’t matter what follows]” to work?

Regards,
Sven

Hi there @sven-abx,

instead of = use LIKE operator.

String to Number node can’t handle percentages and seems File Reader node can’t read this column differently than String type.

Br,
Ivan

2 Likes

Hello @ipazin,

I tried LIKE operator before, but maybe not correct. I got it working now with:
$disc %$ = “-” => 0
$disc %$ = “0.00%” => 0
$disc %$ LIKE “-.” => 0
TRUE => 1

Thanks for your support.

BR,
Sven

1 Like

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