About EasyMorph Tutorials & Examples Web-help

Match action - matching multiple values

Hello,

The match function delivers the first matching value that is found in the lookup column. I would be interested in finding all matching values found in the lookup column, and listing them.

For example, let’s say I want to extract light bulb sockets using Match (with Match Mode “Contains”). In the column “Description” I have “Light bulb E27 or E40”. In the lookup column, I have the following information:

Socket (header)
E27
E40

If I perform the “match” action, E27 will be the first match, and as it has found a match, E27 will be match, and it stops there. E40 will not appear in the match result, as it has already found E27.

I’m looking for a way to get as a result “E27/E40” (so both matches separated by a delimiter), or also creating different lines for each match.

In this case I can’t use regex because I have around 380 different light bulb sockets, and it’s a list that has to be updated and maintained often, so a regex function with 380 OR delimiters (|). That’s why I prefer to use a column for all the sockets and use the Match action (with Match mode “Contains”), as I can update it in an much easier manner.

Is there something I can do here? The same thing can happen to me when I want to extract the color/s (from a long list of possible colors), the materials, etc.

Thanks a lot!

Roberto

You can use iterations to match each description to all lookup values. See the example below.

all-matches.morph (5.4 KB)

Thanks very much, this works great!

I have modified the example you have sent me to include a nested iteration, because I was having the following issue: imagine there’s a socket that is included in another socket (for example, “E2”, which is included in “E27”. In the Description, “Light bulb E27 or E40”, the result would be “E2/E27”, which is incorrect, as it should only be “E27”. To solve this I have added an iteration which checks if any matching value is contained inside another matching value. If that is the case, it deletes that matching value from the end result.

Here I attach the modified EasyMorph project.

Regards,

Roberto

all-real-matches.morph (9.2 KB)

1 Like
To learn more about EasyMorph visit easymorph.com.