Skip to main content

Sort

Category: Transform
Node id: sort

Sorts array data by value or object field in ascending or descending order

What it does​

  • Sort by object field or direct value comparison
  • Ascending and descending order support
  • Numeric and string comparison with type detection
  • Non-stable sort (equal elements may be reordered)

Use cases​

  • Sort lab results by date for chronological display
  • Rank patients by risk score in descending order
  • Order FHIR resources by last-updated timestamp

Runtime​

  • Performance tier: fast

Input ports​

NameTypeRequiredDescription
datajsonYesArray of values or objects to sort

Output ports​

NameTypeRequiredDescription
resultjsonNoSort result: sorted array, count, and order metadata
successbooleanNoWhether the sort operation completed without error

Settings​

Basic​

SettingNameTypeRequiredDefaultAllowed valuesDescription
Sort By Fieldsort_bystringNoField name to sort objects by (leave empty for simple value sorting)
OrderorderenumNoascasc, descSort order

Errors​

CodeDescription
INVALID_DATAInput data is not a valid array

Runtime notes​

  • Leave sort_by empty to sort an array of primitives directly by value
  • Numeric values are compared numerically; non-numeric values fall back to string comparison
  • The sort is not stable: elements with equal sort keys may appear in any order
  • The input array is copied before sorting; the original data input is not mutated

See Build any workflow for how to put nodes together and Ports, types and data flow for how port types connect.

Something unclear? Send documentation feedback by email.