# Map

The Map function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications. returns a new array, where every element is the specified property of each element of the input array.

For example, if the input array is [{result:"1"}, {result:"2"}], using Map(array, "result") returns an array of ["1", "2"].

Inputs

The Map function has the following syntax:

Map(Array, Property)

Parameter | Description
--- | ---
Array | Refers to an array cell.
Property | Refers to the path of the property in the object.

Outputs

Returns | Returns an array of values of the specified property of each element of an array.

Combining Flatten and Map Functions

You can use the Flatten and Map functions together with complex nested objects and arrays to get a simple array to work with.

For example, if the input array is [{result:"1", index:["1","2"]}, {result:"2", index:["3"]}], then Flatten(Map(array, "index")) returns just the list of all the indexes, ["1", "2", "3"].

If a Toolchain function returns a result with multiple views, you can use the Flatten and Map functions together to merge the views. This is useful for sorting all the view results.

In the example below, you can see a Toolchain Segmenter result, which produces three different views from three different ROIs. Each view contains one or two blobs. The Flatten(Map(B26, "blobs")) cell returns a single array that contains all four blobs, which you can pass into SortDescending().