About EasyMorph Tutorials & Examples Web-help

Match action - why skipping first match?

Hello,

In the following example, I’m trying to find matching values in column “Match 1” (before this “match” action, column “Match 1” had the same value as column “des_val”, so basically in the example here it’s doing the match action on the value “a++/a+”.

The lookup table is “Tabla equivalencias(2)”, and the lookup column “Posibles valores”. I have ordered the rows in table “Tabla equivalencias(2)” so that the value “a” is at the last position. I don’t understand why the matching value is “a” when it should be “a++”, which is listed before.

In the opening post to this other thread ("Match" action with mode "Contains" - difficulties matching certain values), I saw that this is the behavior, it matches only the first value in the list. Now I’m trying to reproduce this same behavior, but I 'm not able to do it with this example.

I’m not sure what I’m doing wrong.

Thanks very much,

Roberto

It can be a bug on our side. We’ll look at it.

1 Like

Hey,

This is strange, I created a fast example in a new project to post it here but in this project it works normally. I attach this project here.

Thanks,

Roberto

Example-now-working.morph (1.9 KB)

We’ve taken a look at it and it works correctly. The “Match” action takes any matching value, which may happen be the 1st, or the last, or neither.

PS. The web-help was incorrect about it and will be fixed.

Hello,

So the match action decides in a random manner if it gets the first value it has matched or the last it has matched? In the project “Example-now-working.morph”, it takes the first matching value (which is what I want it to do). However, in the opening post, the screenshot shows that it gets the last value.

Until now, in all projects I’ve done, the Match action has returned the first value it has found. That was just coincidence? Is there a way to always get the first value it has matched?

Thanks!

Roberto

Yes, it was a coincidence.

To always get the 1st (or 2nd, 3rd, etc.) match you can use iterations. See the modified example below:

Fixed-match-position.morph (4.0 KB)

To better understand how the iteration works, go to “Table 2”, right-click the action and chose “Send to sandbox/module -> Module 1”.

Great! Iterations save my day lately :wink:

Thanks,

Roberto

Yes, iterations is a superpower :slight_smile:

You’re welcome!

To learn more about EasyMorph visit easymorph.com.