Sort Node

Sort workflow items by one or more field values. Custom comparator supported.

Written By pvdyck

Last updated 22 minutes ago

Sort Node

The Sort node reorders items based on field values, random shuffle, or a custom JavaScript comparator.

Sort Types

TypeDescription
SimpleSort by one or more field values in ascending or descending order
RandomShuffle items into a random order
CodeWrite a custom JavaScript comparator expression for complex sort logic

Parameters (Simple)

ParameterDescription
Field NameThe field to sort by
OrderAscending or Descending
Add Sort FieldAdd secondary, tertiary, etc. sort fields

Parameters (Code)

ParameterDescription
CodeA JavaScript expression that returns a comparison value. Runs via new Function() in V8, not the QuickJS sandbox

Options

OptionDescription
Disable Dot NotationTreat dots in field names as literal characters

Tips

  • Combine with the Limit node to get "top N" or "bottom N" results
  • Use Simple mode for most cases -- add multiple sort fields for tie-breaking
  • Code mode is useful for custom logic like locale-aware string sorting or multi-criteria comparisons

Limitations

  • No natural sort -- Natural sort order (e.g., "item2" before "item10") is not built in
  • Custom comparator code validation is limited to a regex check for a return keyword

Related