namingconvention

Add new fields to the data extract by using parts of the values from an existing field.

Introduction

Use the namingconvention enrichment to add new fields to the data extract by using parts of the values from an existing field. Use a regular expression to identify which parts of the value to add to a new field. This instruction is a simplified version of the capture instruction.

An error is raised if a match is not found for the regular expression and the enrichment is stopped. This enrichment instruction does not keep the original values.

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 (*).

Field*

Select the column that contains the original values from which to create new values. Choose from one of the following options:

  • String - Select String to enter the name of the column that contains the original values.

  • Integer - Select Integer to enter the position of the column that contains the original values in the data extract.

    Specify where to add the new field in the data extract. To add the field to the first position, specify 0. To add the field to the last position, specify -1.

Pattern*

Enter a regular expression with a number of capturing groups to match values in the source field.

Newfields*

Specify the names of the new fields to add to the data extract. Specify a new field for each capturing group specified in the regular expression in Pattern*. A value in a new field is what the corresponding capturing group matches in the source field's value within the same row.

Subtable

Enter the name for a subtable that you want to contain the enriched data. The enrichment is applied to the whole data extract, then the enriched data is output into the subtable you have named here.

This subtable is a temporary table, which means it 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.

Example

Enrichment configuration

Field*

Campaign

Pattern*

(.*)_(.*)

Newfields*

Campaign type

Campaign ID

Data table before enrichment

Campaign

Ad Group

Clicks

Brand_1

media

7

Brand_2

ecommerce

3

Dashboard_1

media

18

Dashboard_B

media|social

5

Data table after enrichment

Ad Group

Clicks

Campaign type

Campaign ID

media

7

Brand

1

ecommerce

3

Brand

2

media

18

Dashboard

1

media|social

5

Dashboard

B