根
$()
Description: 返回指定节点的数据
Syntax: 语法: $(节点名称)
Returns: 返回: 节点数据
Source: 来源: 自定义 n8n 功能
Parameters: 参数:
nodeName(String) - 要获取数据的节点名称
$binary $二进制
Description: 返回当前节点当前数据项的所有二进制输入数据。是 $input.item.binary 的简写形式。
Syntax: 语法: $binary $二进制
Returns: 返回: 阵列
Source: 来源: 自定义 n8n 功能
$execution $执行
Description: 获取或设置当前执行的元数据
Syntax: 语法: $execution $执行
Returns: 返回: 执行数据
Source: 来源: 自定义 n8n 功能
$fromAI()
Description: 当大语言模型需要提供节点参数的值时使用。建议提供描述以获得更好的结果。
Syntax: 语法: $fromAI(键、描述?、类型?、默认值?)
Returns: 返回: 任意
Source: 来源: 自定义 n8n 功能
Parameters: 参数:
key(String) - 要获取的字段名称。只能包含字母、数字、下划线和连字符。description(String) - 可选 - 用于给模型提供更多上下文,说明应该返回什么内容type(String) - 可选 - 要返回的值的类型。可选值:string、number、boolean、json、date、datetime。默认为string。defaultValue(any) - 可选 - 当模型未返回该键时使用的默认值
Examples: 示例:
javascript
// Ask the model to provide a name, and use it here
$fromAI('name')
javascript
// Ask the model to provide the age of the person (as a number with a default value of 18), and use it here
$fromAI('age', 'The age of the person', 'number', 18)
javascript
// Ask the model to provide a boolean signifying whether the person is a student (with default value false), and use it here
$fromAI('isStudent', 'Is the person a student', 'boolean', false)
$if()
Description: 根据 condition 返回两个值中的一个。类似于 JavaScript 中的 ? 运算符。
Syntax: 语法: $if(条件, valueIfTrue, valueIfFalse)
Returns: 返回: 任意
Source: 来源: 自定义 n8n 功能
Parameters: 参数:
condition(Boolean) - 要进行的检查。应该求值为true或falsevalueIfTrue(any) - 条件为 true 时返回的值valueIfFalse(any) - 条件为 false 时返回的值
Examples: 示例:
javascript
// Return "Good day" if time is before 5pm, otherwise "Good evening"
$if($now.hour < 17, "Good day", "Good evening")
javascript
// $if() calls can be combined:
// Return "Good morning" if time is before 10am, "Good day" it's before 5pm, otherwise "Good evening"
$if($now.hour < 10, "Good morning", $if($now.hour < 17, "Good day", "Good evening"))
$ifEmpty()
Description: 如果第一个参数不为空则返回它,否则返回第二个参数。以下值被视为空:""、[]、{}、null、undefined
Syntax: 语法: $ifEmpty(值, valueIfEmpty)
Returns: 返回: 任意
Source: 来源: 自定义 n8n 功能
Parameters: 参数:
value(any) - 要返回的值(前提是它不为空)valueIfEmpty(any) - 当value为空时返回的值
Examples: 示例:
javascript
"Hi " + $ifEmpty(name, "there") // e.g. "Hi Nathan" or "Hi there"
$input $输入
Description: 当前节点的输入数据
Syntax: 语法: $input $输入
Returns: 返回: 节点数据
Source: 来源: 自定义 n8n 功能
$itemIndex
Description: 当前正在处理的数据项在输入数据项列表中的位置
Syntax: 语法: $itemIndex
Returns: 返回: 编号
Source: 来源: 自定义 n8n 功能
$jmespath()
Description: 使用 JMESPath 表达式从对象(或对象数组)中提取数据。对于查询复杂的嵌套对象非常有用。如果表达式无效则返回 undefined。
Syntax: 语法: $jmespath(对象,表达式)
Returns: 返回: 任意
Source: 来源: 自定义 n8n 功能
Parameters: 参数:
obj(Object|Array) - 要从中提取数据的 Object 或 Object 数组expression(String) - 定义要从对象中提取的数据的 JMESPath 表达式
Examples: 示例:
```javascript data = { "people": [ { "age": 20, "other": "foo", "name": "Bob" }, { "age": 25, "other": "bar", "name": "Fred" }, { "age": 30, "other": "baz", "name": "George" } ] }
// Get all names, in an array {{ $jmespath(data, '[*].name') }} //=> ["Bob", "Fred", "George"]
// Get the names and ages of everyone under 20
$jmespath(data, '[?age > 20].[name, age]') //=> [ ["Fred",25], ["George",30] ]
// Get the name of the first person under 20
$jmespath($json.people, '[?age > 20].name | [0]') //=> Fred
```
```javascript data = { "reservations": [ { "id": 1, "guests": [ { "name": "Nathan", "requirements": { "room": "double", "meal": "vegetarian" } }, { "name": "Meg", "requirements": { "room": "single" } } ] }, { "id": 2, "guests": [ { "name": "Lex", "requirements": { "room": "double" } } ] } ] }
// Get the names of all the guests in each reservation that require a double room
$jmespath(data, 'reservations[].guests[?requirements.room==double].name')
```
$json
Description: 返回当前节点当前数据项的 JSON 输入数据。是 $input.item.json 的简写形式。更多信息
Syntax: 语法: $json
Returns: 返回: 对象
Source: 来源: 自定义 n8n 功能
$max()
Description: 返回给定数字中的最大值
Syntax: 语法: $max(num1, num2, …, numN)
Returns: 返回: 编号
Source: 来源: 自定义 n8n 功能
Parameters: 参数:
num1(Number) - 要比较的第一个数字num2(Number) - 要比较的第二个数字
$min()
Description: 返回给定数字中的最小值
Syntax: 语法: $min(num1, num2, …, numN)
Returns: 返回: 编号
Source: 来源: 自定义 n8n 功能
Parameters: 参数:
num1(Number) - 要比较的第一个数字num2(Number) - 要比较的第二个数字
$nodeVersion
Description: 当前节点的版本号(显示在节点设置面板底部)
Syntax: 语法: $nodeVersion
Returns: 返回: 字符串
Source: 来源: 自定义 n8n 功能
$now $现在
Description: 表示当前时刻的 DateTime。
使用工作流的时区(可以在工作流设置中更改)。
Syntax: 语法: $now $现在
Returns: 返回: 日期时间
Source: 来源: 自定义 n8n 功能
$pageCount
Description: 节点已获取的结果页数。仅在 'HTTP Request' 节点中可用。
Syntax: 语法: $pageCount
Returns: 返回: 编号
Source: 来源: 自定义 n8n 功能
$parameter $参数
Description: 当前节点的配置设置。这些是你在节点 UI 中填写的参数(例如其操作类型)。
Syntax: 语法: $parameter $参数
Returns: 返回: 节点参数
Source: 来源: 自定义 n8n 功能
$prevNode
Description: 关于当前输入来源节点的信息。
在 'Merge' 节点中时,始终使用第一个输入连接器。
Syntax: 语法: $prevNode
Returns: 返回: 上一个节点数据
Source: 来源: 自定义 n8n 功能
$request $请求
Description: 节点最近一次运行时发送的请求对象。仅在 'HTTP Request' 节点中可用。
Syntax: 语法: $request $请求
Returns: 返回: 对象
Source: 来源: 自定义 n8n 功能
$response $响应
Description: 最近一次 HTTP 调用返回的响应。仅在 'HTTP Request' 节点中可用。
Syntax: 语法: $response $响应
Returns: 返回: HTTP响应
Source: 来源: 自定义 n8n 功能
$runIndex
Description: 当前节点执行的当前运行索引。从 0 开始。
Syntax: 语法: $runIndex
Returns: 返回: 编号
Source: 来源: 自定义 n8n 功能
$secrets $秘密
Description: 来自外部密钥保管库的密钥(如果已配置)。密钥值永远不会向用户显示。仅在凭据字段中可用。
Syntax: 语法: $secrets $秘密
Returns: 返回: 对象
Source: 来源: 自定义 n8n 功能
$today 今天$
Description: 表示当天午夜零点的 DateTime。
使用实例的时区(除非在工作流设置中被覆盖)。
Syntax: 语法: $today 今天$
Returns: 返回: 日期时间
Source: 来源: 自定义 n8n 功能
$vars
Description: 工作流可用的变量
Syntax: 语法: $vars
Returns: 返回: 对象
Source: 来源: 自定义 n8n 功能
$workflow $工作流程
Description: 关于当前工作流的信息
Syntax: 语法: $workflow $工作流程
Returns: 返回: 工作流程数据
Source: 来源: 自定义 n8n 功能