跳转到内容
Agentic Workflowdocs
v0.8.2免费安装

节点 / builtin / datatransformation

Sort

Order the incoming items by one or more fields, or shuffle them randomly

数据 扩展程序网页应用

此内容尚不支持你的语言。

Put your items in order by one or more fields, such as cheapest first or newest first, or shuffle them.

Sort reorders the whole incoming list at once. No items are added or removed.

  • By fields: you add sort keys under Sort By. Each key names a field, a Direction and a way to compare (Compare As). Keys apply in order: the second key only decides between items that tie on the first.
  • Random (shuffle): the items are put in a random order and the sort keys are ignored.

Items that tie keep their original order. Items where the field is missing, null or empty always go last, in both directions, so empty rows never float to the top of a descending list.

  • Show results newest first or cheapest first before you send or save them.
  • Get a real “top 5” by sorting before Limit.
  • Pick which copy Remove Duplicates keeps: it keeps the first one, so sort first.
  • Take a random sample: shuffle, then Limit.
设置项类型作用
Mode ChoiceSort by field values, or shuffle into a random order. Options: By fields, Random (shuffle). 默认值:By fields
Sort By List of entriesFields to sort by, applied in order.
Sort By (each entry) › Field (必填)TextField to sort by. Use dots for nested fields, e.g. user.profile.name.
Sort By (each entry) › Direction ChoiceOptions: Ascending, Descending. 默认值:Ascending
Sort By (each entry) › Compare As ChoiceHow values in this field are compared. Options: Automatic, Number, Text, Text (natural), Date. 默认值:Automatic

Compare As decides how two values are compared:

  • Automatic treats values as numbers when it can, then as dates, otherwise as text in natural order.
  • Text (natural) reads digits as numbers inside text, so item 2 comes before item 10.
  • Text compares character by character, so item 10 comes before item 2. Use it for codes that must sort strictly by character.
  • Number and Date force that reading. Use Number when prices or counts arrive as text.

Use dots for nested fields, for example price.amount. A key with an empty Field is ignored.

  • Output

The same items in their new order.

None. This node needs no connection and has no slots for other nodes.

  1. HTML Extract reads a list of products with name and price from a shop page.
  2. Sort with two keys: Field price, Direction Ascending, Compare As Number; then Field name, Direction Ascending, to break ties.
  3. Limit with Max Items 5 keeps the five cheapest.
  4. A Slack node posts them.
  • The order does not change. Sort needs a list. If the previous node sends one item that holds a list in a field, split it first with Split Out. Also check that at least one key has a Field.
  • 10 comes before 2. The values are compared as text. Set Compare As to Number, or Text (natural) for text with numbers inside.
  • Empty items sit at the bottom of a descending sort. This is on purpose: missing and empty values always go last.
  • “No source node is connected to this node.” Connect the node that produces the list to Sort’s input.
  • Limit: keep the first or last few items after sorting.
  • Remove Duplicates: drop copies, keeping the first.
  • Split Out: turn a list field into items you can sort.
编辑此页

最近更新:

Was this page useful?
向 Aria 询问“Sort”