Replace a list of words in a cell

Hi all,
I’d like to replace each word in the same column (which corresponds with SAP code status) , with the corresponding text. But I wonder if there is any direct possibility using a node. I have tried using the string replace dictionary , but it only replaces the cell if it matches with the whole key, not individually.

image

image

Then, other way I found out to do that, is by splitting the cell in a list, then ungroup the rows, join tables and then group again. Is there any simple way to do that? I guess a loop could be used, but I’m still studying these topics and I’m not familiarized with it.

Thank you in advance

1 Like

Hello @Sgomezba,

have a feeling I know what are you looking for but if you share input data and desired output it would make things much easier :wink:

Br,
Ivan

1 Like

Hi there,

Maybe Split, Rule Engine, and Column Aggregator?

ok, I’ll give you one row example:

Input:

image

Lookup table (one value example)

image

Desired ouput (i just want to replace “code” for “text”)

image

thank you

Hi @Sgomezba , when we ask to share some sample data, it means some data we can work with, that is something we can copy and paste and use, basically it means in text version, not a screenshot where we can’t copy the data from :slight_smile:

3 Likes

Hi @Sgomezba !!

In addition to previous proposals I would like to add one more alternative to your case.

You can use Knime text processing nodes for your task. All you need is convert the input column to document type (target to be modified) using ‘String to Document’ node, then you can use a ‘Dictionary Replacer’ and finally, use ‘Document Data Extractor’ node to get the modified text.

Would be helpful if you add a file/workflow with data. Hope it works. Here is a small example.

Text replacement.knwf (25.9 KB)

10 Likes

Hi @Sgomezba

Maybe you don’t need to re-invent the wheel.
Take a look to this elegant solution suggested by @Iris

BR

5 Likes

sorry @bruno29a , I will take into account for future posts :innocent:

thanks @cristiancandia and @gonhaddock , you were very helpful

4 Likes

Nice one @cristiancandia :+1:
Ivan

3 Likes

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