cut

Select and keep specific columns in a data extract.

This guide explains how to configure the cut instruction. To learn about another instruction, go back to the Available custom script instructions overview.

Introduction

Use the cut instruction to keep selected columns in a data extract and remove all unselected columns.

For example, if you have 30 columns and want to keep 3, use cut to select the three columns you want to keep. If you have 30 columns and want to keep 27, use cutout instead to select the columns you want to remove.

Understanding the different cut instructions

There are a number of different cutcustom script instructions that can be used to keep selected fields. The different types of cut instruction are:

  • cut - select and keep specific columns in a data extract

  • cutout - select and remove specific columns from a data extract

  • cutoutre - select and remove specific columns in a data extract using a regular expression

  • cutre - select and keep specific columns from a data extract using a regular expression

Creating a custom script enrichment using the cut instruction

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

  1. Create a custom script enrichment.

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

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

Fields (required)

Select String and enter the name of the column to keep in the data extract, or select Integer and enter the position of the column to keep in the data extract.

Click to add multiple columns to keep in the data extract.

Subtable

Enter the name for a subtable that you want to use within this custom script.

A subtable is a temporary table that 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.

If a subtable does not exist for the current custom script, the enrichment is applied to the data extract, and the enriched data is output into the subtable. If the subtable already exists for the custom script, the subtable is used as the input for the enrichment and optionally as the output.

Example

Enrichment configuration

Fields

Campaign and Clicks

Data table before enrichment

Campaign

Ad Group

Clicks

Date

Brand

In-App

5568

2022-02-11

Ecommerce

In-App

7815

2022-02-11

Growth

Media

6443

2022-02-11

Data table after enrichment

Campaign

Clicks

Brand

5568

Ecommerce

7815

Growth

6443