timecast

Split a date range across multiple rows in a data extract.

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

Introduction

Use the timecast instruction to split a data range across multiple rows in a data extract.

Creating a custom script enrichment using the timecast instruction

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

  1. Create a custom script enrichment.

  2. In the Instructions step, select the timecast 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 new column that will contain the split date range values. This new column is added at the end of the data extract.

Start Field*

Enter the name of the column that contains the start of the date range.

End Field*

Enter the name of the column that contains the end of the date range.

Interval*

Select the interval in which to split the data. Choose one of the following:

  • minutes

  • hours

  • days

  • weeks

Increment*

Enter a number for the size of the increment. For example, to split a date range into days, enter 1. To split a date range into every third day, enter 3.

Date Format*

Enter the format for the split date range values. The default date format is %Y-%m-%d.

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

Fieldname*

Campaign Dates

Start Field*

Campaign Start

End Field*

Campaign End

Interval*

days

Increment*

1

Date Format*

%Y-%m-%d

Data table before enrichment

Campaign

Campaign Start

Campaign End

Clicks

Aerified

2021-11-01

2021-11-02

12345

Kanlam

2022-01-03

2022-01-07

56789

Data table after enrichment

Campaign

Campaign Start

Campaign End

Clicks

Campaign Dates

Aerified

2021-11-01

2021-11-02

12345

2021-11-01

Aerified

2021-11-01

2021-11-02

12345

2021-11-02

Kanlam

2022-01-03

2022-01-07

56789

2022-01-03

Kanlam

2022-01-03

2022-01-07

56789

2022-01-04

Kanlam

2022-01-03

2022-01-07

56789

2022-01-05

Kanlam

2022-01-03

2022-01-07

56789

2022-01-06

Kanlam

2022-01-03

2022-01-07

56789

2022-01-07