addrownumbers
Add a new column to the data extract with row numbers.
This guide explains how to configure the addrownumbers instruction. To learn about another instruction, go back to the Available custom script instructions overview.
Introduction
Use the addrownumbers instruction to add a new column to the data extract with row numbers.
Creating a custom script transformation using the addrownumbers instruction
To create and configure a custom script using the addrownumbers instruction, follow these steps:
-
In the Instructions step, select the addrownumbers instruction.
-
To configure the custom script instruction, fill in the following fields. Required fields are marked with an asterisk (*).
-
Field name*
-
Specify the name of the new column to add to the data extract.
-
Start value*
-
Specify the first value in the new column. Row numbering starts with this value.
-
Row increment*
-
Specify the number with which row numbers are incremented.
Example
Transformation configuration
-
Field Name
-
Row
-
Start Value
-
2
-
Row Increment
-
2
-
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.
Data table before transformation
Ad Group |
Clicks |
---|---|
media |
7 |
ecommerce |
3 |
media|social |
18 |
social |
9 |
Data table after transformation
Ad Group |
Clicks |
Row |
---|---|---|
media |
7 |
2 |
ecommerce |
3 |
4 |
media|social |
18 |
6 |
social |
9 |
8 |