unpacklist

Separate values contained in lists into rows in a data extract.

Introduction

Use the unpacklist enrichment to separate lists contained in a single column of a data extract into separate rows within a newly created column. This enrichment can also unpack a list of lists.

Before you unpack the lists, run the convertx enrichment with the following Python expression: __import__('ast').literal_eval({FIELD})

Replace FIELD with the name of the column that contains the lists. Running this enrichment enables Adverity to read the lists. For more information, see the Python documentation.

Creating the enrichment

For more information on creating an enrichment, see Using custom scripts.

Configuring the enrichment

To configure the enrichment, fill in the following fields. Required fields are marked with an asterisk (*).

Field

Enter the name of the column that contains the lists.

Newfield

Enter the name of the new column that is to be added to the data extract. Adverity populates this column with the list items.

Include Original

Select this checkbox to keep the column that contains the lists in the data extract.

Subtable

Enter the name for a subtable that you want to contain the enriched data. The enrichment is applied to the whole data extract, then the enriched data is output into the subtable you have named here.

This subtable is a temporary table, which means it 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.

Example

Enrichment configuration

Field*

Account IDs

Newfield

IDs

Include Original

Leave this checkbox unselected.

Data table before enrichment

Campaign

Account IDs

Brand

[1, 2, 3, 4]

Brand

["Five", "Six", "Seven"]

Dashboard

([A, B, C], [D, E, F])

Data table after enrichment

Campaign

IDs

Brand

1

Brand

2

Brand

3

Brand

4

Brand

Five

Brand

Six

Brand

Seven

Dashboard

[A, B, C]

Dashboard

[D, E, F]