melt

Transpose certain parts of a table.

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

Introduction

Use the melt instruction to transpose all the table columns that are not selected into rows. Enter the name of the column to keep as a column and all other columns are transposed into rows.

Creating a custom script enrichment using the melt instruction

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

  1. Create a custom script enrichment.

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

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

Key

Enter the name of the column that you do not want to be transposed. To keep multiple columns as columns, click and enter the names of the columns you do not want to be transposed.

Variablefield

Enter the name for the new column that will contain the original names of the transposed columns.

Valuefield

Enter the name for the new column that will contain the original values of the transposed columns.

Variables

If the columns to be transposed contain a subset of variables, enter the names of the variables to transpose. Any columns that are not entered in this field will not be transposed. See Example 2 below.

Example 1

Enrichment configuration

Key

Campaign

Variablefield

Transposed columns

Valuefield

Transposed values

Data table before enrichment

Campaign

Ad Group

Clicks

Brand

media

7

Brand

ecommerce

3

Dashboard

media|social

18

Data table after enrichment

Campaign

Transposed columns

Transposed values

Brand

Ad Group

media

Brand

Clicks

7

Brand

Ad Group

ecommerce

Brand

Clicks

3

Dashboard

Ad Group

media|social

Dashboard

Clicks

18

Example 2

In this example, the Variable field is populated with the value Clicks. This means only Clicks column is transposed along with the corresponding values.

Enrichment configuration

Key

Campaign

Variablefield

Transposed columns

Valuefield

Transposed values

Variable

Clicks

Data table before enrichment

Campaign

Ad Group

Clicks

Brand

media

7

Brand

ecommerce

3

Dashboard

media|social

18

Data table after enrichment

Campaign

Transposed columns

Transposed values

Brand

Clicks

7

Brand

Clicks

3

Dashboard

Clicks

18