Identify whether a Column "partially" contains strings (SEE EXAMPLE)

Hello everyone!
I am new to this software and am looking for some help in solving a seemingly simple problem that I am however stuck on.

As in the example reposted below I have a list of brands (column 1) and a list of products (column 2) in which the brand is also inside. What I would like to do is to be able to split these two pieces of information, identifying which brand is inside column 2 and then create two new ones one with just the brand and one with just the product.

Thank you very much in advance the help!

KNIME_project.knwf (5.4 KB)

Hi @takeAfew

Welcome to KNIME forum. I created this wf KNIME_project_22.knwf (51.7 KB). See what it can do for you.


gr. Hans

5 Likes

Hi @HansS Thank you very much, you have brought me very close to the goal!

One thing I didn’t specify is the assumption that the band column (Column 1) is incomplete and you don’t know any names/rows.

In this case in the ouput result in the “product column” there should be all the product name and brand, instead in the result of the “brand column” there should be a constant that makes this situation clear (like a string “not know”).

If you can help me you are number 1!

1 Like

Hi @takeAfew

It is a little bit confusing to me.
Is it correct that you have only 1 input column (Input Brand + Product) ?
Or is there also a column Input Brand? And what is the content?

gr. Hans

Hi @HansS ,
you are right, I misspoke.
Perhaps with the updated image it is clearer what the inputs and desired outputs are.

Thanks again for the help!
KNIME_project (2).knwf (5.3 KB)

image

1 Like

Hi @takeAfew

Ok that’s clear. And tnx for the sample data you provided.It makes working on a solution much more convenient. I added a Joiner and a Rule Engine node to the flow.
KNIME_project_22-new.knwf (68.5 KB)


Hope this helps. Happy KNIME-ing.

gr. Hans

3 Likes

Hello @takeAfew
I’ve tested an approach avoiding loops.

20230222_identify_strings_in_text_v0.knwf (38.8 KB)

BR

4 Likes

It’s perfect, ty! @HansS

3 Likes

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