Skip to main content Skip to complementary content

Compare lists block

The block Compare lists can be used to find common or unique items between 2 given lists (arrays).

The Compare Lists block.

The Compare Lists block.

The block takes two lists as input:

The Compare Lists input tab.

The Inputs tab, containing List 1 and List 2 fields.

Example settings:

The Compare Lists settings tab.

The Settings tab. It contains a List 1 Unique Key field set to profile.email, a List 2 Unique Key field set to email, and a Compare Results field set to Unique in list1.

When you choose Intersect for the option Compare results, you can choose how the result is returned by this block:

The Compare Results and Results fields.

The Compare Results and Results field. Compare Results is set to: Intersect. Results is set to: Items from list1.

Example lists

Example list 1:

[
      {"email": "john@doe.com", "name": "John Doe"},
      {"email": "bill@acme.com", "name": "Bill Davis"}
]

Example list 2:

[
      {"email": "john@doe.com", "city": "NY"},
      {"email": "ann@acme.com", "city": "Paris"}
]

Unique keys

Enter the key on which objects in each list will be compared. For example, email in one list and profile.email in the second. Objects will be matched/merged based on the values from these keys.

Compare results

Unique in list 1 (all items in list 1 that do not exist in list 2) If we match on keys email, the result of the above example lists will be:

[
      {"email": "bill@acme.com", "name": "Bill Davis"}
]

Note: if you want to have objects that are unique in list 2, you should switch both lists and use the option unique in list 1.

Intersect (all items that exist in both list 1 and list 2) If we match on keys email, and you set the Results option to Items from list 1, the result of the above example lists will be:

[
      {"email": "john@doe.com", "name": "John Doe"}
]

If we match on keys email, and you set the Results option to Merged items from list 1 and list 2, the result of the above example lists will be:

[
      {"email": "john@doe.com", "name": "John Doe",  "city": "NY"}
]

Iterator

This block does not use an iterator, which means that both input lists will be loaded in memory before doing the compare. This means that an automation using this block will fail with an out of memory error for very large lists.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!