获取上一个节点返回的项目数
¥Get number of items returned by the previous node
要获取上一个节点返回的项目数:
¥To get the number of items returned by the previous node:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 | ```js
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.
```json
[
{
"results": 8
}
]
```
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 | if len(items[0].json) == 0:
return [
{
"json": {
"results": 0,
}
}
]
else:
return [
{
"json": {
"results": items.length,
}
}
]
|
The output will be similar to the following.
| ```json
[
{
"results": 8
}
]
```
|