search
Search for certain values in a data extract.
This guide explains how to configure the search instruction. To learn about another instruction, go back to the Available custom script instructions overview.
Introduction
Use the search instruction to find certain values in a data extract using a regular expression. Only the rows of the data extract that contain the values matching the regular expression are kept, and all other rows are removed.
Creating a custom script transformation using the search instruction
To create and configure a custom script using the search instruction, follow these steps:
-
In the Instructions step, select the search instruction.
-
To configure the custom script instruction, fill in the following fields. Required fields are marked with an asterisk (*).
-
Field*
-
Enter the name of the column in which to search.
-
Pattern*
-
Enter a regular expression used to search for values in the data extract.
-
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.
Example
Transformation configuration
-
Field
-
Campaign Start
-
Pattern*
-
(.*)-(.*)-(.*22$)
Data table before transformation
Campaign Start |
Campaign End |
Ad Group |
Clicks |
---|---|---|---|
01-12-2021 |
10-01-2022 |
media |
7,653 |
31-01-2021 |
28-02-2021 |
ecommerce |
3,106 |
21-12-2021 |
21-01-2022 |
brand awareness |
18,012 |
31-01-2022 |
31-03-2022 |
ecommerce |
4,945 |
05-03-2022 |
15-03-2022 |
media|social |
571 |
10-01-2022 |
31-01-2022 |
media|social |
119 |
Data table after transformation
Campaign Start |
Campaign End |
Ad Group |
Clicks |
---|---|---|---|
31-01-2022 |
31-03-2022 |
ecommerce |
4,945 |
05-03-2022 |
15-03-2022 |
media|social |
571 |
10-01-2022 |
31-01-2022 |
media|social |
119 |