capture

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

Introduction

Use the capture enrichment to add new fields to the data extract by capturing parts of the values from an existing field.

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

Specify the field which contains the original values. To the left of Source field*, specify the data type of the source field.

Pattern

Specify 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.

Include Original

Select this checkbox to retain the source field. If you leave this checkbox deselected, the source field is removed during the enrichment process.

Fill

By default, Adverity displays an error if it does not find a match using the regular expression in Pattern*. To prevent this behavior, Adverity can fill values corresponding to non-matching capturing groups with pre-defined values. Specify a list or tuple of the pre-defined values in Default values. In this list or tuple, specify a value for each capturing group you specify in the regular expression in Pattern*.

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

(.*)_(\d+)

Newfields

Campaign type

Campaign ID

Include Original

Selected

Fill

unknown

empty

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

Dashboard3

media

11

Data table after enrichment

Campaign

Ad Group

Clicks

Campaign type

Campaign ID

Brand_1

media

7

Brand

1

Brand_2

ecommerce

3

Brand

2

Dashboard_1

media

18

Dashboard

1

Dashboard_B

media|social

5

Dashboard

empty

Dashboard3

media

11

unknown

empty