构建工作流
Get number of items returned by last node
To get the number of items returned by the previous node:
JavaScript
if (Object.keys(items[0].json).length === 0) {
return [
{
json: {
results: 0,
}
}
]
}
return [
{
json: {
results: items.length,
}
}
];The output will be similar to the following.
[
{
"results": 8
}
]Python
if len(items[0].json) == 0:
return [
{
"json": {
"results": 0,
}
}
]
else:
return [
{
"json": {
"results": items.length,
}
}
]The output will be similar to the following.
[
{
"results": 8
}
]官方原文和授权
本页来自 N8N 英文官方网站固定快照,并转换成 xueai 静态页面。内容以 N8N 持续更新的官方页面为准。