Skip to main content

MAP

Extracts values from an array of objects using a property name or property path.

Description

MAP returns an array containing the value of a specified attribute from each element in an input array.

If the input is a JSON string, MAP first parses it into an array. This makes it useful for working with functions like REPORT('terms', ...), which often return structured JSON arrays.


Syntax

MAP(input, path)

Arguments

  • input: The source array or a JSON string representing an array.
  • path: The attribute name or nested property path to extract from each item.

Returns

Returns an array of extracted values.

If:

  • input is not an array
  • input cannot be parsed as JSON
  • an error occurs

then MAP returns an empty array:

[]

Examples

Basic Array Mapping

MAP(
[
{ key: "Priority 1", count: 3 },
{ key: "Priority 2", count: 1 },
{ key: "Priority 3", count: 1 }
],
"key"
)
→ ["Priority 1", "Priority 2", "Priority 3"]
MAP(
[
{ key: "Priority 1", count: 3 },
{ key: "Priority 2", count: 1 },
{ key: "Priority 3", count: 1 }
],
"count"
)
→ [3, 1, 1]

Nested Property Paths

MAP(
[
{ metrics: { value: 10 } },
{ metrics: { value: 20 } },
{ metrics: { value: 30 } }
],
"metrics.value"
)
→ [10, 20, 30]

JSON String Input

MAP(
'[{"key":"Open","count":5},{"key":"Closed","count":2}]',
"key"
)
→ ["Open", "Closed"]

Usage Notes

  • MAP works only on arrays
  • JSON string inputs are automatically parsed
  • Nested paths are supported using dot notation

Typical Dashboard Pattern

A1 = REPORT('terms', 'AnyDB Issue', 'Priority')
A2 = MAP(A1, "key")
A3 = MAP(A1, "count")

Summary

MAP is a utility function for extracting attributes from arrays, commonly used with REPORT outputs for charts and dashboards.