Check if at least 1 element is contained in an array

Dear all,

I have 2 arrays :

  • Array 1 : [element1, element 2, element 3, element 4]
  • Array 2 : [element2, element 4]

I want to check if at least 1 element of Array 2 is contained in Array 1.
In this case, element2 of Array 2 exists in Array 1, so it should return true.

I know that I need to loop but I don’t know how I could use array aggregator combined with a filter, and so on.

Could you please help me on this issue ?

Thank you,

Hello @undefined! Welcome!!

For this, you have to use an Iterator. For example, you iterate on Array 2, and in the next filter, you use the contains function with Array 1 as first parameter, and the “value” from the Iterator as second parameter. If this function returns “true”, it means it’s in Array 1

After this test, what do you want to do? Do you want to Aggregate Array 2 again, but with only the values that matched Array 1? Or anything else.

If you need some screenshots, let me know, I will build an example.

Kind regards

Benjamin

2 Likes

Salut!

Try to change the filter to a “Array Operators / Contains”

The one you chose is for Strings.

Benjamin

2 Likes

Thank you, but it still says that 208.code is empty, although it’s not empty at all…

image
image
image

Thank you

The output of your iterator doesn’t seem to match what you showed in the previous screenshot (where you Split the string).

Can you provide me with a global screenshot of the part in the scenario, as well as the configuration of the steps and screenshots? Or, send me the blueprint of your scenario.

Benjamin

1 Like

Thanks!!

It’s weird, I think there is an issue with the log display. I also see “empty”, but it worked in my case.


You see it shows “Empty”, but it compared true

I adapted a bit the scenario since I don’t have access to Quable, let me show you my config


From my example, I get only 1 matched item from Quable.

Can you try and test with a value you are sure you get from the Quable webhook and change attributs_pour_FT accordingly and see if you get an array element in the last step?

I think your scenario works :slight_smile:

1 Like

You are right, from the beginning it was working but the “empty” display wasn’t.
Topic solved, thank you!

1 Like

Great it works now! Don’t forget to always select the correct Filter type according to the Data type you compare.

Kind regards,

Benjamin

2 Likes

Hello,

Just a little note for you and all community members. The “Empty” logs in the filters is a known issue; Make product management is on it to fix it :slightly_smiling_face:

And, it doesn’t affect the execution of the Filters, it’s only a display issue.

Benjamin

2 Likes