filltimegaps
Add rows to a data extract containing missing dates in a date range.
This guide explains how to configure the filltimegaps instruction. To learn about another instruction, go back to the Available custom script instructions overview.
Introduction
Use the filltimegap instruction to add new rows to a data extract that contain any missing values in a date or time range. For example, if you have the dates for the start and end of a week, use this instruction to add a row to the data extract for each missing date in the date range of the week. You can also choose the time interval to use and the format of the date.
Use the filldown instruction to populate the empty fields in the new rows.
Creating a custom script transformation using the filltimegaps instruction
To create and configure a custom script using the filltimegaps instruction, follow these steps:
-
In the Instructions step, select the filltimegaps instruction.
-
To configure the custom script instruction, fill in the following fields. Required fields are marked with an asterisk (*).
-
Timestamp Field*
-
Enter the name of the column that contains the date or time range for which to add in the missing values.
-
Timestamp Format*
-
Enter the format of the time or date range for which to add in the missing values. For example
%Y-%m-%d
or%h:%s
. -
Interval
-
Select the time interval to determine how many additional rows to add to the data extract.
For example, the range across two rows is 2022-01-20 and 2022-01-22. If you select
day
then one row is added for the date 2022-01-21.In another example, if the date is the same across two consecutive rows and you select
hour
then twenty three new rows are added between the two dates - one for each hour interval. -
Presorted
-
Select this option if the data extract has been sorted prior to the transformation. This makes the transformation faster.
-
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
-
Timestamp Field*
-
Campaign Start
-
Timestamp Format*
-
%Y-%m-%d
-
Interval
-
Day
-
Presorted
-
Select this field.
Data table before transformation
Campaign |
Campaign Start |
Clicks |
---|---|---|
Aerified |
2022-11-01 |
12345 |
Kanlam |
2022-11-05 |
56789 |
Data table after transformation
Campaign |
Campaign Start |
Clicks |
---|---|---|
Aerified |
2022-11-01 |
12345 |
2022-11-02 |
||
2022-11-03 |
||
2022-11-04 |
||
Kanlam |
2022-11-05 |
56789 |