# Sorting Functions

Sorting functions sort arrays in ascending or descending order.

Multiple properties can be specified for sorting. If two values are the same of the first specified property, then they are sorted by the second specified property.

The following functions can sort arrays:

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. | Parameters | Description
--- | --- | ---
SortAscending | Array, [Property, ...] | Sorts an array in ascending order. If the Array contains objects, sorts by the specified property or properties of the objects.
SortDescending | Array, [Property, ...] | Sorts an array in descending order. If the Array contains objects, sorts by the specified property or properties of the objects.

Example: Sorting with one property specified

The C8 cell in spreadsheet contains an array of boxes that the Toolchain Locator tool returns. You can sort the boxes based on their y-axis to identify which row belongs to which box:

SortAscending(C8,"y")

Example: Sorting with two properties specified

The C8 cell in spreadsheet contains an array of boxes. You can specify the score and the y-axis as the properties. The function first sorts the array based on scores, and when two boxes share the same score, the function sorts these objects by the position on the y-axis:

SortDescending(C8,"scores/0/score","y")