Table of Contents

Search

  1. Preface
  2. The Transformation Language
  3. Constants
  4. Operators
  5. Variables
  6. Dates
  7. Functions

Transformation Language Reference

Transformation Language Reference

COLLECT_MAP

COLLECT_MAP

Returns a map with elements based on the specified arguments.

Syntax

COLLECT_MAP(map_key as ANY, map_value as ANY)
The following table describes the arguments for this command:
Argument
Required/Optional
Description
map_key
Required
Any primitive data type. The elements that you want to aggregate as keys of a hierarchical data of type map. You can enter any valid transformation expression.
map_value
Required
Any primitive or complex data type. The elements that you want to aggregate as values of a hierarchical data of type map. You can enter any valid transformation expression.

Return Value

Map.

Group By

COLLECT_MAP groups values based on group by ports you define in the transformation, returning one result for each group.
If there is no group by port, COLLECT_MAP treats all rows as one group, returning one value.

Examples

The following expression returns a map with the elements in the PRODUCT_ID as keys and elements in the PRODUCT_NAME as values.
COLLECT_MAP(PRODUCT_ID, PRODUCT_NAME)
PRODUCT_ID
PRODUCT_NAME
34890
Flashlight
12754
Compass
54028
Pressure Gauge
81203
Vest
RETURN VALUE:
[34890 -> Flashlight, 12754 -> Compass, 54028 -> Pressure Gauge, 81203 -> Vest]

0 COMMENTS

We’d like to hear from you!