mergecolumn
Combine fields from different columns into a single column.
Introduction
Use the mergecolumn enrichment to combine different columns in a data extract into a single column. The combined values are stored in a JSON-style dictionary. The name of the column is stored as the dictionary key, and the value within the column is stored as the dictionary value.
Creating the enrichment
For more information on creating an enrichment, see Using custom scripts.
Configuring the enrichment
To configure the enrichment, fill in the following fields. Required fields are marked with an asterisk (*).
-
Fieldname*
-
Enter the name of the new column that contains the merged values.
-
Columns
-
Enter the names of the columns to combine into one column. Click
to add the names of more columns to combine. If you select this option, the All and Prefix fields are disabled.
-
All
-
Select this option if you want to merge all the columns within a table into a single column. If you select this option, the Columns and Prefix fields are disabled.
-
Prefix
-
Enter the start of the names of the columns to merge. For example, enter
Ad_
into prefix and only the column names that start withAd_
are included in the merge enrichment.The names of the columns in the final merged data extract are renamed and the entered prefix is removed. For example, a Prefix of
Ad_
would renameAd_Clicks
toClicks
.If you select this option, the Columns and All fields are disabled.
-
Include
-
Enter the names of fields to be merged.
-
Exclude
-
Enter the names of the columns to be excluded from the merge. Use this option if you have selected the All option.
-
Drop
-
Select this option to remove the original columns from the data extract. If selected, the original columns will remain in the data extract along with the merged columns.
-
Serializer
-
Select the format in which the merged values are stored. Currently, the only option is JSON.
Example
Enrichment configuration
-
Fieldname*
-
Ad Group Clicks
-
Columns
-
-
Ad_Groups
-
Ad_Clicks
-
-
Drop
-
Select this checkbox.
-
Serializer
-
JSON
Data table before enrichment
Campaign |
Ad_Group |
Ad_Clicks |
---|---|---|
Brand |
media |
7 |
Brand |
ecommerce |
3 |
Dashboard |
media|social |
18 |
Data table after enrichment
Campaign |
Ad Group Clicks |
---|---|
Brand |
{"Ad Group":"media", "Clicks":"7"} |
Brand |
{"Ad Group":"ecommerce", "Clicks":"3"} |
Dashboard |
{"Ad Group":"media|social", "Clicks":"18"} |