Transform map values

Supported in: Batch

Transforms values of a map by applying an expression to every key-value pair.

Expression categories: Map

Declared arguments

  • Expression to apply. - The expression to apply once per key-value pair of the map.
    Expression<V>
  • Map - Map expression.
    Expression<Map<K, AnyType>>

Type variable bounds: K accepts AnyType**V accepts AnyType

Output type: Map<K, V>

Examples

Example 1: Base case

Argument values:

  • Expression to apply.:
    stringBeforeDelimiter(
     delimiter: -,
     expression: value,
     ignoreCase: false,
    )
  • Map: flight_number
flight_numberOutput
{
 1 -> XB-134,
 2 -> MT-111,
}
{
 1 -> XB,
 2 -> MT,
}

Example 2: Base case

Argument values:

  • Expression to apply.:
    cast(
     expression: value,
     type: Integer,
    )
  • Map: flight_number
flight_numberOutput
{
 1 -> 11,
 2 -> 22,
}
{
 1 -> 11,
 2 -> 22,
}

Example 3: Base case

Argument values:

  • Expression to apply.:
    cast(
     expression: key,
     type: String,
    )
  • Map: flight_number
flight_numberOutput
{
 1 -> 11,
 2 -> 22,
}
{
 1 -> 1,
 2 -> 2,
}

Example 4: Base case

Argument values:

  • Expression to apply.:
    concatStrings(
     expressions: [
    stringBeforeDelimiter(
     delimiter: -,
     expression: key,
     ignoreCase: false,
    ), value],
     separator: -,
    )
  • Map: flight_number
flight_numberOutput
{
 MT-111 -> BB,
 XB-134 -> AA,
}
{
 MT-111 -> MT-BB,
 XB-134 -> XB-AA,
}