fillright
Fill empty fields in the data extract using values in the field to the left of an empty field.
This guide explains how to configure the fillright instruction. To learn about another instruction, go back to the Available custom script instructions overview.
Introduction
Use the fillright instruction to fill in the empty fields in a data extract. Choose what Adverity should treat as an empty field and these empty fields are populated with values from the field to the left of the empty field.
Empty values in the first column will remain empty as there is no field to the left with which to populate the field to the right. If a field in the first column contains an empty value and there are consecutive empty fields to the right of this empty field within the same row, then these fields will remain empty as there is no value with which to populate them (this is shown in the example below).
Creating a custom script transformation using the fillright instruction
To create and configure a custom script using the fillright instruction, follow these steps:
-
In the Instructions step, select the fillright instruction.
-
To configure the custom script instruction, fill in the following fields. Required fields are marked with an asterisk (*).
-
Missing
-
Enter the missing value for Adverity to search. For example, a value like
null
orn/a
could be treated as a missing value. Leave this field blank to search and fill only the fields that are empty.
-
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
-
Missing
-
null
Data table before transformation
Campaign |
Ad Group |
Clicks |
Impressions |
---|---|---|---|
Brand |
media |
2792 |
7766 |
Brand |
ecommerce |
2792 |
9124 |
Brand |
null |
null |
2345 |
Dashboard |
ecommerce |
null |
556 |
Dashboard |
longevity |
4875 |
7935 |
null |
media|social |
6531 |
null |
Outreach |
null |
8619 |
2649 |
Outreach |
organic growth |
3260 |
5689 |
null |
null |
null |
4176 |
Data table after transformation
Campaign |
Ad Group |
Clicks |
Impressions |
---|---|---|---|
Brand |
media |
2792 |
7766 |
Brand |
ecommerce |
2792 |
9124 |
Brand |
Brand |
Brand |
2345 |
Dashboard |
ecommerce |
ecommerce |
556 |
Dashboard |
longevity |
4875 |
7935 |
null |
media|social |
6531 |
6531 |
Outreach |
Outreach |
8619 |
2649 |
Outreach |
organic growth |
3260 |
5689 |
null |
null |
null |
4176 |