selectinvt

Keep rows that match values in a value table.

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

Introduction

Use the selectinvt instruction to find and keep rows in a data extract if they match values in a value table. Only the rows of the data extract that are a match are kept, and all other rows are removed. For more information on creating value tables, see Creating value tables.

Creating a custom script transformation using the selectinvt instruction

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

  1. Create a custom script transformation.

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

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

Fieldname*

Enter the name of the column that contains the values used to match with the values in the value table.

Select a column in one of the following ways:

  • Select String and enter the name of the column.

  • Select Integer and enter the position of the column in the data extract as an index value. Counting starts at 0. To select the first column, enter 0. To select the second column, enter 1. To select the last column in the data extract, enter -1.

Value Table Name*

Enter the value table that contains the values to match.

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*

Ad Group

Value Table Name

Ad Group Types

value table to use in transformation

Ad Group Types

media

ecommerce

Data table before transformation

Campaign

Ad Group

Clicks

Brand

media

7

Branding

ecommerce

3

Dashboard

brand awareness

18

Brand

ecommerce

4

Dashboard

media|social

5

Branding

media

11

Data table after transformation

Campaign

Ad Group

Clicks

Brand

media

7

Branding

ecommerce

3

Brand

ecommerce

4

Branding

media

11