Help: Check 2 arrays, remove duplicate items from array 2 if in array 1

Hi, I have two arrays. I need to check if any items in array two are in array 1, and if so, remove them. I tried defining the two arrays, creating an iterator, and looping through the first array, but I can’t figure out how to update the 2nd array correctly. I think I may have approached this totally wrong from the beginning.

How can I take two arrays and filter array 2 by array 1, and if any of the items in array 1 are in array 2, remove just those items and return the updated array 2 for use in my scenario? What modules do I need?

I’m totally lost here. Thanks!!!

Hey Sam,

depending on the data inside, you can try with the contains() function. Iterate on the first array and check item by item if its contained in the second array.

Welcome to the Make community!

If you need further assistance, please provide the following:

1. Relevant Screenshots

We need to see what you’re working with to give you the best advice. It would help by having screenshots of:

  • the full scenario,
  • any error messages,
  • individual module fields,
  • relevant filter settings (conditions), and
  • module output bundles
  • external services (spreadsheet headers, sample data, etc.)

You can upload images here using the Upload icon in the text editor:

We would appreciate it if you could upload screenshots here instead of linking to them outside of the forum. This allows us to zoom in on the image when clicked, and avoid tracking cookies from third-party websites.

2. Scenario Blueprint

Please export the scenario blueprint. Providing your scenario blueprint file will allow others to quickly recreate and see how you have set up the mappings in each module, and also allows us take screenshots or provide module exports of any solutions we have for you in return - this would greatly benefit you in implementing our suggestions as you can simply paste module exports back into your scenario editor!

To export your scenario blueprint, click the three dots at the bottom of the editor then choose ‘Export Blueprint’.

You can upload the file here by clicking on this button:

3. Output Bundles of Modules

Please provide the output bundles of each of the relevant modules by running the scenario (you can also get this without re-running your scenario from the History tab).

Click on the white speech bubbles on the top-right of each module and select “Download input/output bundles”.

A. Upload as a Text File

Save each bundle contents in a plain text editor (without formatting) as a bundle.txt file.

You can upload the file here by clicking on this button:

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format button in the editor

Providing the input/output bundles will allow others to replicate what is going on in the scenario, especially if there are complex data structures (nested arrays and collections) or if external services are involved, and help you with mapping the raw property names from collections.

Sharing these details will make it easier for others to assist you.

Hey Sam,

Here is what you can do,

Would love to assist if needed

1 Like

Thank you!!! I was able to create this based on what you advised:

Full scenario

Module 1

Module 2

Module 3

Module 4

Module 5

Module 6

Here’s my scenario blueprint:
array v4.blueprint.json (9.8 KB)

For anyone wondering, this solves the SendGrid Send an Email crash where you must have unique To, Copy Recipient and Blind Copy Recipient, but you also want to give each an array of email addresses.

Solves error:
[400] Error on field PERSONALIZATIONS → 0: Each email address in the personalization block should be unique between to, cc, and bcc. We found the first duplicate instance of

1 Like

This was my filter condition: