Skip to content
Book a demo

Connect documentation

All documentation
Documentation

addfield

On this page

Add a new column to the data extract that contains the same value in every row.

Introduction

Use the addfield instruction to add a new column to your data extract and specify a value that this column will contain in every row.

Creating a custom script transformation using the addfield instruction

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

  1. Create a custom script transformation.

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

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

Field name (required)

Specify the name of the new column to add to the data extract.

Field index (required)

Specify where to add the new column in the data extract. To add the column to the first position, specify 0. To add the column to the last position, specify -1.

Field value

Specify the value to use in every row of the new column. If you leave this field empty, the new column added to your data extract will be empty.

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 transformation 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 transformation and optionally as the output.

Example

Transformation configuration

Field Name

Country

Field Value

Austria

Field Index

2

Data table before transformation

Scroll horizontally to see the full table.

Campaign

Ad Group

Clicks

Brand

media

7

Brand

ecommerce

3

Dashboard

media|social

18

Data table after transformation

Scroll horizontally to see the full table.

Campaign

Ad Group

Country

Clicks

Brand

media

Austria

7

Brand

ecommerce

Austria

3

Dashboard

media|social

Austria

18