groupFilter
groupFilter
component: filter node group. Groups multiple Filter
nodes into a group, and if all nodes are True, sends the data to the True
chain, otherwise sends it to the False
chain.
If allMatches=false, then as long as any node returns True, it sends it to the True
chain
# Configuration
Field | Type | Required | Description | Default value |
---|---|---|---|---|
allMatches | bool | No | Whether all nodes are required to match | false |
nodeIds | string | Yes | List of node IDs in the group, multiple IDs separated by , | - |
timeout | int | No | Execution timeout, in seconds, default: 0 means no timeout | 0 |
# Relation Type
- True: Send the message to the
True
chain - False: Send the message to the
False
chain - Failure: nodeIds is empty or execution timed out, send to the
Failure
chain
allMatches=true All nodes must match to send to the True chain, if false, then as long as any node matches, it sends to the True chain
# Execution result
This component will not change the content of msg
, metadata
and msgType
.
# Configuration example
Reference example: group_filter_node (opens new window)
//Note: The rule chain starts from the third node. firstNodeIndex=2
{
"ruleChain": {
"id": "rule01",
"name": "Test rule chain",
"root": true
},
"metadata": {
"firstNodeIndex": 2,
"nodes": [
{
"id": "s1",
"type": "jsFilter",
"name": "Filter 1",
"debugMode": true,
"configuration": {
"jsScript": "return msg.temperature > 50;"
}
},
{
"id": "s2",
"type": "jsFilter",
"name": "Filter 2",
"debugMode": true,
"configuration": {
"jsScript": "return msg.humidity > 80;"
}
},
{
"id": "group1",
"type": "groupFilter",
"name": "Filter group",
"debugMode": true,
"configuration": {
"allMatches": false,
"nodeIds": "s1,s2"
}
},
{
"id": "s3",
"type": "log",
"name": "Log",
"debugMode": false,
"configuration": {
"jsScript": "return 'call this node for True relation';"
}
},
{
"id": "s4",
"type": "log",
"name": "Log",
"debugMode": false,
"configuration": {
"jsScript": "return 'call this node for False relation';"
}
}
],
"connections": [
{
"fromId": "group1",
"toId": "s3",
"type": "True"
},
{
"fromId": "group1",
"toId": "s4",
"type": "False"
}
]
}
}
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Edit this page on GitHub (opens new window)
Last Updated: 2024/10/23, 10:13:01