Skip to content
Book a demo

Connect documentation

All documentation
Documentation

convertx

On this page

Convert values in a selected column in a data extract using a Python expression.

Introduction

Use the convertx instruction to use a Python expression to convert values in a selected column.

When to use this instruction

Use convertx when:

  • You need free-form Python logic to transform the values in a single column (for example text cleaning, conditional replacements, or simple calculations).

  • Built-in converters (such as convert or convertdates) are not flexible enough for your use case.

  • You want to apply RegEx-based logic directly in a column. For more patterns, see Using RegEx in Python expressions and Using Python expressions to process text columns.

Creating a custom script transformation using the convertx instruction

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

  1. Create a custom script transformation.

  2. In the Instruction step, select the convertx instruction.

  3. To configure the custom script instruction, fill in the required fields below, as well as any optional fields you require:

Field (required)

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

Python expression (required)

Enter a Python expression to convert the values in the column you have selected.

Fail on error

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

Example

Transformation configuration

This transformation converts every character in the Ad Group column to lower case.

Fields

Ad group

Python Expression

{Ad Group}.lower()

Data table before transformation

Scroll horizontally to see the full table.

Campaign

Ad Group

Clicks

Brand

OnGoing

75856

Outreach

OnGoing

38753

Organic Growth

InActive

99651

Data table after transformation

Scroll horizontally to see the full table.

Campaign

Ad Group

Clicks

Brand

ongoing

75856

Outreach

ongoing

38753

Organic Growth

inactive

99651