Skip to content

排序#

¥Sort

使用 Sort 节点按所需顺序整理项目列表,或生成随机选择。

¥Use the Sort node to organize lists of items in a desired ordering, or generate a random selection.

Array sort behavior

“排序”操作使用默认的 JavaScript 操作,其中要排序的元素被转换为字符串并比较它们的值。请参阅 Mozilla 数组排序指南 了解更多信息。

¥The Sort operation uses the default JavaScript operation where the elements to be sorted are converted into strings and their values compared. Refer to Mozilla's guide to Array sort to learn more.

节点参数#

¥Node parameters

使用“类型”参数配置此节点。

¥Configure this node using the Type parameter.

使用下拉菜单从以下选项中选择排序方式。

¥Use the dropdown to select how you want to input the sorting from these options.

简单#

¥Simple

使用选定的字段执行升序或降序排序。

¥Performs an ascending or descending sort using the selected fields.

选择此项后,n8n 会将节点添加到画布并将其打开。类型:

¥When you select this Type:

  • 使用“添加排序字段”按钮输入字段名称。

¥Use the Add Field To Sort By button to input the Field Name.

  • 选择使用升序还是降序排列。

¥Select whether to use Ascending or Descending order.

简单选项#

¥Simple options

选择“简单”作为类型时,可以选择“禁用点号表示法”。默认情况下,n8n 启用点表示法,以 parent.child 格式引用子字段。使用此选项可禁用点号表示法(已启用)或继续使用点号表示法(已禁用)。

¥When you select Simple as the Type, you have the option to Disable Dot Notation. By default, n8n enables dot notation to reference child fields in the format parent.child. Use this option to disable dot notation (turned on) or to continue using dot (turned off).

Random#

在列表中随机排序。

¥Creates a random order in the list.

代码#

¥Code

输入自定义 JavaScript 代码以执行排序操作。如果简单的排序无法满足你的需求,这是一个不错的选择。

¥Input custom JavaScript code to perform the sort operation. This is a good option if a simple sort won't meet your needs.

在“代码”输入框中输入你的自定义 JavaScript 代码。

¥Enter your custom JavaScript code in the Code input field.

模板和示例#

¥Templates and examples

Template widget placeholder.

相关资源#

¥Related resources

Learn more about data structure and data flow in n8n workflows.