rename#
Rename fields in the header.
Note
This guide explains how to configure the rename instruction. To learn about another instruction, go back to the Custom scripts available in Adverity overview.
Introduction#
Use the rename instruction to rename fields in the header of the data extract. Rename fields based on their position in the header or based on the name to change.
There are two ways to configure the rename custom script instruction:
Using Old name and New name - use this option if you only want to rename one column in your data extract
Using Fields - use this option if you want to rename multiple columns in your data extract
Configuring the rename instruction using Old name and New name#
To create and configure the rename custom script using Old name and New name, follow these steps:
In the Instructions step, select the rename instruction.
To configure the custom script instruction, fill in the required fields below, as well as any optional fields you require:
- Old name (required)
Specify the column to be renamed. Choose one of the following options:
String - Select this option and enter the name of the column to be renamed.
Integer - Select this option and enter the position in the data extract of the column to be renamed. Counting starts at zero. To select the first column, enter
0
. To select the second column, enter1
. To select the last column in the data extract, enter-1
.
- New name (required)
Specify the new name for the selected column. Choose one of the following options:
String - Select this option and enter the new name for the column.
Integer - Select this option to copy the name of another column in the data extract. Enter the position in the data extract of the column you want to copy.
- Strict
Select this option to raise an error if a field could not be found during the transformation. Leave this field unselected to continue with the transformation if a field is not found.
- 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#
- Old Name
Select Integer and enter
0
.- New Name
Select String and enter Campaign Name.
Data table before transformation#
Campaign |
Ad Group |
Clicks |
---|---|---|
Brand |
media |
7 |
Brand |
ecommerce |
7 |
Dashboard |
media |
29 |
Dashboard |
media|social |
5 |
Data table after transformation#
Campaign Name |
Ad Group |
Clicks |
---|---|---|
Brand |
media |
7 |
Brand |
ecommerce |
7 |
Dashboard |
media |
29 |
Dashboard |
media|social |
5 |
Configuring the rename instruction using Fields#
To create and configure the rename custom script using Fields, follow these steps:
In the Instructions step, select the rename instruction.
To configure the custom script instruction, fill in the required fields below, as well as any optional fields you require:
- Fields (required)
For each field you want to rename, follow these steps:
Click + to add a field to this instruction.
Specify the column to be renamed. Choose one of the following options:
In the left text box, enter the name of the column to be renamed.
In the drop-down menu, select String.
In the left text box, enter the position in the data extract of the column to be renamed (counting starts at zero).
In the drop-down menu, select Integer.
In the right text box, specify the new name for the selected column.
- Strict
Select this option to raise an error if a field could not be found during the transformation. Leave this field unselected to continue with the transformation if a field is not found.
- 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#
Fields*
Field to rename |
Object type |
New name |
---|---|---|
Campaign |
String |
Campaign Name |
1 |
Integer |
Ad Type |
Clicks |
String |
Click Through |
Data table before transformation#
Campaign |
Ad Group |
Clicks |
---|---|---|
Brand |
media |
7 |
Brand |
ecommerce |
7 |
Dashboard |
media |
29 |
Dashboard |
media|social |
5 |
Data table after transformation#
Campaign Name |
Ad Type |
Click Through |
---|---|---|
Brand |
media |
7 |
Brand |
ecommerce |
7 |
Dashboard |
media |
29 |
Dashboard |
media|social |
5 |