Replacing strings in a column based on a reference table

Hi,

I’m looking to replace all instances of several strings in a column. Is there a way to quickly to this by referencing a table? E.g., a table like this:

image

would transform these values:

Orange juice
Lemon pie
Chicken strips
Turkey stuffing
Broccoli soup
Tomato sauce

into:

Citrus juice
Citrus pie
Poultry strips
Poultry stuffing
Green soup
Red sauce

Many thanks!

Hi @mac95

Have a look at this

Br

3 Likes

Thanks, @hfma.

Unfortunately, I can only get this to work if the cell value equals one of my dictionary values - not if it contains one of these values. So, any cell equal to “Orange” is replaced with “Citrus”, but any cell equal to “Orange juice” is unchanged.

Do you know if this node capable of replacing sub-strings?

Best,

M

Hello @mac95

For a literal match; I would suggest to loop over your reference table with ‘Table Row To Variable Loop Start’.
Connect your loop variable port to your data through a String Manipulation node, with the replace(str, search, replace) function, then you can close the loop with a Loop End node.

BR

Hi @mac95

Yes it does. It depends on your configuration.
Try this workflow

String replacer.knwf (74.4 KB)

Input table
image
Disctionary
image
Node configuration


Result

Br

4 Likes

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