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

MAP_FROM_ARRAYS

MAP_FROM_ARRAYS

Generates a map from the specified key and value arrays.

Syntax

MAP_FROM_ARRAYS(map_keys as ARRAY, map_values as ARRAY)
The following table describes the arguments for this command:
Argument
Required/Optional
Description
map_keys
Required
Array type with elements of primitive data type. Array of elements that you want to add as keys of the map data. You can enter any valid transformation expression.
map_values
Required
Array type with elements of any data type. Array of elements that you want to add as values for keys of the map data. You can enter any valid transformation expression.
The number of elements in the map_keys array and map_values array must match. If you use the MAP function in an output expression for a map port, the data type of the function arguments must match the data type of the map elements specified in the type configuration for the map port.

Return Value

Map.
The data type of arguments determines the data type of the map elements. For example, if you pass integer arguments as key and struct arguments as value, the function generates map data with a key-value pair of integer and struct types.

Examples

The following expression generates a map from the array elements of string type.
MAP_FROM_ARRAYS(cust_name, cust_phone)
cust_type
cust_name
cust_phone
RETURN VALUE
silver
[Adams, Clark]
[205-128-6478, 722-515-2889]
[Adams -> 205-128-6478, Clark -> 722-515-2889]
gold
[Baker, Davis]
[107-081-0961, 718-051-8116]
[Baker -> 107-081-0961, Davis -> 718-051-8116]
platinum
[Evans, Hills]
[344-894-6463, 861-411-8361]
[Evans -> 344-894-6463, Hills -> 861-411-8361]

0 COMMENTS

We’d like to hear from you!