You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature: Workflow Split controllers now offer an optional "item filter" expression, to filter out specific items based on their properties, or array index, or other. Fixes#298.
Copy file name to clipboardExpand all lines: docs/workflows.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,14 +80,28 @@ Controllers implement flow control. They generally have input and output poles a
80
80
81
81
#### Split Controller
82
82
83
-
The Split controller fans out work by taking an input list and launching one sub-job per item. Provide a dot-path to the list in the previous job context, such as `data.rows`. The engine resolves the path and expects an array; if the value is a string it is trimmed and split by newline. A special case is `files`, which splits the incoming files array so that each sub-job receives exactly one file.
83
+
The Split controller fans out work by taking an input list and launching one sub-job per item. Provide an [expression](xyexp.md) to the list in the previous job context, such as `data.rows`. The engine resolves the path and expects an array; if the value is a string it is trimmed and split by newline. A special case is `files`, which splits the incoming files array so that each sub-job receives exactly one file.
84
84
85
85
In the UI, the split controller configuration dialog provides an "Expression Builder" button, which allows you to explore output data from recently completed jobs, and pick out a specific JSON key path to use for the expression string.
86
86
87
87
Each individual sub-job will receive one item from the split data. It will arrive in the job's [Job.input](data.md#job-input), either in `data` as a property named `item`, or as a [File](data.md#file) in the `files` array.
88
88
89
89
Split requires exactly one output connection to the Event or Job node it will run per item. Concurrency and queuing are governed by the limits attached to that node. After all items complete, you can continue the flow using a `continue` wire from the controlled node. The controller includes a "continue percentage" setting so you can require that at least N% of the sub-jobs succeed before continuing.
90
90
91
+
##### Split Item Filter
92
+
93
+
You can optionally filter out items from your split array, by including a special item filter expression. In this context use the special `item` keyword to refer to the item being filtered. If your expression evaluates to true, the item will be included in the set. Otherwise, it will be left out. Here is an example using a property inside the item:
94
+
95
+
```js
96
+
item.random<0.5
97
+
```
98
+
99
+
Also available in context here is `index` (the 0-based index of the current item in the set), `workflow.params` (all workflow-level user fields), and `workflowData` (shared workflow data object). For example, here is how to filter out all odd items, and only keep the even ones, using the modulo operator:
100
+
101
+
```js
102
+
index %2==0
103
+
```
104
+
91
105
#### Join Controller
92
106
93
107
The Join controller waits for multiple incoming flows to finish, then passes a combined result to the next step. You can wire multiple inputs into a Join; it initializes when the first input arrives and completes after all of its inputs have fired.
Copy file name to clipboardExpand all lines: internal/ui.json
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -583,11 +583,15 @@
583
583
},
584
584
"d_wfd_split": {
585
585
"label": "Split Expression:",
586
-
"caption": "Specify the path to the array for splitting, using `dot.path.notation`. Use the special `files` keyword to split the input files."
586
+
"caption": "Specify the path to the array for splitting, using [XYEXP](#Docs/xyexp), e.g. `data.items`. Use the special `files` keyword to split the input files."
587
+
},
588
+
"d_wfd_split_filter": {
589
+
"label": "Item Filter:",
590
+
"caption": "Optionally enter an expression to filter items, e.g. `item.random > 0.5`. If false, the item will be excluded from the set. [Learn More](#Docs/workflows/split-item-filter)"
587
591
},
588
592
"d_wfd_if": {
589
593
"label": "Expression:",
590
-
"caption": "Enter the expression to evaluate using dot.path.notation, e.g. `data.random > 0.5`. If true, control will pass onto the next node."
594
+
"caption": "Enter the expression to evaluate using [XYEXP](#Docs/xyexp), e.g. `data.random > 0.5`. If true, control will pass onto the next node."
0 commit comments