Creating a new column and populating values based another column values

Hi All,

I want to create a new column and populate values based another column in the same row. Example : I have an ID number in which 1st character denotes which team he represents, Based on the first character i need to populate a abbreviated team name in a new column.
Screen Shot 2024-03-04 at 11.51.25 PM

Hello @vamsi4uonly,

and welcome to KNIME Community!

You can use Rule Engine node. There you can write such rules using LIKE operator.

For example:
$yourColumnName$ LIKE "A*" => "Australia"
$yourColumnName$ LIKE "U*" => "USA"
ā€¦

If you have too many rules and want to keep them in dictionary table you can extract first character from your ID column using substr() function from String Manipulation node and then follow it up with Cell Replacer node to add whole team name based on abbreviated team name. For creating dictionary table you can use Table Creator node.

Hope this gets you started!

Br,
Ivan

4 Likes

Hello @vamsi4uonly

You might apply the following workflow:


New_value_based_column.knwf (76.6 KB)

2nd table contains list of teams with their IDs which should be quite easy to manage.

I hope you will find it helpful.
Happy KNIMEing,
Kaz

4 Likes

Thanks This helped me.

1 Like

Great @vamsi4uonly ! Could you please mark my post as solution then? Being KNIME newbe, Iā€™m still collecting solutions:)

1 Like

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