How can I add words in a New column

Hi everyone, Now I would like to add a new column in my table so I used Constant Value Column.

Then, I would like to add words in different rows.

How can I do it?

Hello @HKuser,

there are many ways of doing so. One option is the Rule Engine node, where you can add new words based on some rules.

If this doesn’t help, can you please let me know a bit more about what you are trying to achieve?

Best
Kathrin

Really Thanks! Now I know I can use rule engine node to add some words.

Maybe let me describe my case
image

I would like to create a new column named Aging Problem. When there is Aging wordings appear in the Other reasons column, then switch to Aging Problem.

When there is broken by friends appeared in Other reasons, change it to by third party and then put into reasons coulmn.

I am new to knime so I am so stupid in this! Sorry for the inconvenience.

Hi,

There are no stupid questions, when getting started with a new tool :slight_smile:

Tip: In your screenshot it looks like your column headers are actually not used as column headers. You might want to go back to the nodes that reads your data and change the settings, so that your column headers are used as column headers.

Then you can use the columns to formulate your rules in the Rule Engine node. The expression could look like this:

$Other Reasons$ = “Aging” => “Aging”
$Other Reasons$ = “Broken by friends” =>" By Third Party"

This video gives you and introduction to the Rule Engine node. https://www.youtube.com/watch?v=mJrBXmLQ4ko

Best
Kathrin

2 Likes

If i do not want to create a new column, I put all red words (Changed word) in to Reasons Column

How to do it?

Many Thanks!

In the bottom of the configuration window of the Rule Engine node you can select between appending a new column and replacing a column. In this case you can select replace column and select then the column Reasons.

Yes! I can do this!

But i found that the other records will become “?”

You can fix this by adding a third rule. In case the first and the second rule doesn’t match it will just use the values which is already in the column Reasons

$Other Reasons$ = “Aging” => “Aging”
$Other Reasons$ = “Broken by friends” =>" By Third Party"
TRUE=> $Reasons$

I can get all the result now! Really Thanks!

But how can i delete the words when the words (Broken by friends, Aging) have switched to Column Reasons?

If you want to remove the column, you can use the Column Filter node.
If you just want to replace them with an empty string, you can use a second Rule Engine node to replace values in the column Other Reasons with the following rules:
$Other Reasons$ = “Aging” => “”
$Other Reasons$ = “Broken by friends” =>" "
TRUE=> $Other Reasons$

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