delta
On this page
Compare data extracts, and return unique rows into a new data extract.
Introduction
Use the delta instruction to return a delta of your data extracts. A delta is a comparison of data extracts that finds unique rows, and returns these rows in a new data extract.
Creating a custom script transformation using the delta instruction
To create and configure a custom script using the delta instruction, follow these steps:
-
In the Instruction step, select the delta instruction.
-
To configure the custom script instruction, fill in the following fields. Required fields are marked with an asterisk (*).
- All
Select this checkbox to include all previous data extracts from the datastream in the comparison. The initial data extract contains all values, and each subsequent extract adds only the new rows found.
- Distinct
Select this checkbox to create a new data extract that contains the unique rows found using the comparison.
- Include Tags
Enter keywords to include specific data extracts in the comparison.
- Exclude Tags
Enter keywords to exclude specific data extracts from the comparison.
- Presorted
Select this checkbox if the included data extracts are presorted.
- Subtable
Enter the name for a subtable that you want to use within this custom script.
A subtable is a temporary table that only exists for this custom script. You can apply additional instructions within the same custom script to the subtable. However, the subtable cannot be used in any other custom scripts.
If a subtable does not exist for the current custom script, the transformation is applied to the data extract, and the enriched data is output into the subtable. If the subtable already exists for the custom script, the subtable is used as the input for the transformation and optionally as the output.
Examples
The following examples show how the delta instruction finds unique rows across two data extracts.
Scenario 1: one unique row in each extract
Data extract 1 has 5 rows, of which 4 also exist in data extract 2. Data extract 2 has 5 rows, of which 4 also exist in data extract 1. The result contains 2 rows — one unique row from each extract.
Data extract 1
Scroll horizontally to see the full table.
Date | Campaign | Clicks |
|---|---|---|
1 Jan | Brand | 100 |
2 Jan | Brand | 150 |
3 Jan | Brand | 200 |
4 Jan | Brand | 250 |
5 Jan | Brand | 300 |
Data extract 2
Scroll horizontally to see the full table.
Date | Campaign | Clicks |
|---|---|---|
2 Jan | Brand | 150 |
3 Jan | Brand | 200 |
4 Jan | Brand | 250 |
5 Jan | Brand | 300 |
6 Jan | Brand | 350 |
Result
Scroll horizontally to see the full table.
Date | Campaign | Clicks |
|---|---|---|
1 Jan | Brand | 100 |
6 Jan | Brand | 350 |
Scenario 2: unique row only in the first extract
Data extract 1 has 4 rows, of which 3 also exist in data extract 2. Data extract 2 has 3 rows, all of which also exist in data extract 1. The result contains 1 row — the row unique to data extract 1.
Data extract 1
Scroll horizontally to see the full table.
Date | Campaign | Clicks |
|---|---|---|
1 Jan | Brand | 100 |
2 Jan | Brand | 150 |
3 Jan | Brand | 200 |
4 Jan | Brand | 250 |
Data extract 2
Scroll horizontally to see the full table.
Date | Campaign | Clicks |
|---|---|---|
2 Jan | Brand | 150 |
3 Jan | Brand | 200 |
4 Jan | Brand | 250 |
Result
Scroll horizontally to see the full table.
Date | Campaign | Clicks |
|---|---|---|
1 Jan | Brand | 100 |
Scenario 3: unique row only in the second extract
Data extract 1 has 3 rows, all of which also exist in data extract 2. Data extract 2 has 4 rows, of which 3 also exist in data extract 1. The result contains 1 row — the row unique to data extract 2.
Data extract 1
Scroll horizontally to see the full table.
Date | Campaign | Clicks |
|---|---|---|
1 Jan | Brand | 100 |
2 Jan | Brand | 150 |
3 Jan | Brand | 200 |
Data extract 2
Scroll horizontally to see the full table.
Date | Campaign | Clicks |
|---|---|---|
1 Jan | Brand | 100 |
2 Jan | Brand | 150 |
3 Jan | Brand | 200 |
4 Jan | Brand | 250 |
Result
Scroll horizontally to see the full table.
Date | Campaign | Clicks |
|---|---|---|
4 Jan | Brand | 250 |