Replace all compositions of numbers with "1"

Hi,

I have a column consisting of several values from -1 to 99.
I need to replace every composition of numbers (0-99) with 1.

I have tried with String Manipulator, but I cannot figure out how to configure it. I have tried with both replace and replaceChars.

It is not clear if you have a string or numerical data type. Also, what do you mean by composition? To answer those questions, could you please provide data example?

The data type was numerical, but I have changed it to string in order to use String Manipulator - so I can use both.
By composition I mean every number from 0-99, e.g. 2, 7, 16, 32, 88, etc.

Here is an example.

Do you mean that you want to change the value in the Opera column, for every row, to be 1?

Yes, everyone but those with -1. But I think I have fixed it using Rule Engine.

2 Likes

Hi,

You do not have to convert the column type to string.
Just use a Math Formula node with this expression:
if($Opera$ >= 0, 1, -1)

Best,
Armin

2 Likes

Hi there!

In Rule Engine node use:

$Opera$  LIKE "-1" => $Opera$
TRUE => "1"

with option to replace column.

If numerical column Math Formula does it as @armingrudd described it.

Br,
Ivan

2 Likes

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