convert

Convert values in a data extract.

Introduction

Use the convert enrichment instruction to convert the values in a column of a data extract. You can use a Python expression as a converter. For example, use the Python expression capitalize to make the first character of a string upper case and all other characters in the string lower case.

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

Fields

Enter the name of the column containing the values to convert.

Converter

To use a Python expression as a converter, select String and enter the Python expression to use as a converter. For a full list of compatible converters, see the Python documentation.

To simply convert values from one value to another, follow these steps:

  1. Select Object from the drop-down menu to the right of Converter.

  2. In the text field to the right of Object, enter the value to be converted.

  3. Select the type in which the value is to be converted. For example, to convert a value into an integer, select Integer.

  4. Enter the new value into which to convert.

  5. (Optional) Click Add to convert another value using the same instruction.

Fail on Error

Select this field to stop the enrichment instruction if the conversion cannot be applied.

Errorvalue

Enter the value with which to populate the field if an error occurs.

Example

Enrichment configuration

Fields

Campaign

Ad Group

Converter

capitalize

Data table before enrichment

Campaign

Ad Group

Clicks

brand

media

75856

outreach

weekend ecommerce

38753

organic growth

socials

99651

Data table before enrichment

Campaign

Ad Group

Clicks

Brand

Media

75856

Outreach

Weekend Ecommerce

38753

Organic Growth

Socials

99651