Diff Lists
Identify the differences between two input lists.
Use Case
You need to compare two lists and highlight the unique entries or entries exclusive to the first list, and require a transformation action that simplifies this complex comparison process.
Overview
The Diff Lists
transform is your solution for list comparison tasks. It uses two methods - Anti-Join
and Symmetric Difference
- to focus on unique or exclusive entries, thereby streamlining your data comparison process.
Parameters
Here are the parameters you have available to you within the action, and their descriptions:
Difference Method
Choose the method to compute the differences between the lists. Options are anti_join
and symmetric_difference
(described below).
First List
Enter the first list to be compared.
First List's Key
Identify the key attribute for matching items in the first list.
Second List
Enter the second list to be compared.
Second List's Key
Identify the key attribute for matching items in the second list.
Usage
Input Lists
For this transform, we will want to feed the action two separate lists, that we will then identify the fields in which we want to identify differences. Let's use these two lists as example:
List 1:
List 2:
Difference Methods
We have two options for the Difference Method
you can pick to have the action perform, these method have slight differences that are quite helpful in various situations:
Anti-Join: for scenarios where you want to find entries that are exclusive to the first list.
Symmetric Difference: for comparing two sets of data and identifying unique records in each.
Take a look at examples of both below:
The Symmetric Difference
method is used when you want to identify entries that are unique to each list, i.e., items that exist in the one list and not in the other.
The Anti Join
difference method is used when you want to determine the items in the first list that don't have a corresponding match in the second list.
Results Output
The results of the two different diff methods can be seen as follows:
Anti Join: only Mary's object from list_1
is returned in the output, as she didn't have a correlating id
in list_2
.
Symmetric Difference: both Mary's object from list_1
and the object in list_2
that didn't have a correlating id in list_1
were returned in the returned list.
With a grasp on the Diff Lists
transform, you're ready to analyze and compare your lists for unique entries or entries exclusive to the first list. Understanding the differences between Anti-Join
and Symmetric Difference
methods will aid you in making effective data comparisons.
Want more practice?
Last updated