mergesort

Combine data from a sorted data extract with another sorted data extract from a different datastream.

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

Introduction

Use the mergesort instruction to combine data from a sorted data extract with another sorted data extract from a different datastream. This is useful for large data extracts which have been sorted by the column.

It is not necessary to sort the data extracts before using this enrichment. However, it works much faster if the data extracts to merge are sorted. To indicate a data extract is sorted, select the Presorted field.

Creating a custom script enrichment using the mergesort instruction

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

  1. Create a custom script enrichment.

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

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

Streams

Enter the name of the datastream (or datastreams) to merge into the data extract to which the enrichment is applied. The datastreams you enter here must contain data extracts that are sorted by the same column as the current data extract.

Subtables

Enter the name of the subtable to merge into the data extract to which the enrichment is applied. The subtables must be sorted by the same column as the current data extract subtable.

Include Tags

If data extracts have been tagged using the set_tags enrichment, enter the tags of the data extracts to include in the enrichment.

Exclude Tags

If data extracts have been tagged using the set_tags enrichment, enter the tags of the data extracts to exclude from the enrichment.

All

Select this field to merge all data extracts belonging to a datastream

Key

Enter the name of the column that contains the sorted data.

Reverse

Select this checkbox if the data extracts have been sorted in reverse order.

Presorted

Select this checkbox if the data extracts to merge are sorted.

Header

Enter the header values to include in the header of the merged data extract. Only the header values entered in the Header field are included in the final merged data extract. If you enter a header value and it is not included in the data extracts to merge, the final merged data extract will be empty.