convertallx#

Convert all the values in a data extract using a Python expression.

Note

This guide explains how to configure the convertallx instruction. To learn about another instruction, go back to the Custom scripts available in Adverity overview.

Introduction#

Use the convertallx instruction to convert all the values in a data extract using a Python expression.

Creating a custom script transformation using the convertallx instruction#

To create and configure a custom script using the convertallx instruction, follow these steps:

  1. Create a custom script transformation.

  2. In the Instructions step, select the convertallx instruction.

  3. To configure the custom script instruction, fill in the following fields. Required fields are marked with an asterisk (*).

Python Expression

Enter a Python expression to use as a converter. For a full list of compatible converters, see the Python documentation.

Fail on Error

Select this field to stop the transformation instruction if an error occurs.

Example#

Transformation configuration#

To remove leading and trailing characters from values in the table, use the Python strip function.

Python Expression
{_value}.strip('_')

Data table before transformation#

Campaign

Ad Group

Clicks

_brand

media_

75856

_outreach

weekend_ecommerce_

38753

_organic_growth

socials_

99651

Data table after transformation#

Campaign

Ad Group

Clicks

brand

media

75856

outreach

weekend_ecommerce

38753

organic_growth

socials

99651