For each
Flow-Knoten
forEachlogicRuns the steps after it once for each item of a list, one after the other, then goes on after the last.
Auf einen Blick
| Eigenschaft | Wert |
|---|---|
| Node field | forEach (set instead of stepRef on a FlowNode) |
| Side effects | no |
A FlowNode sets exactly one of stepRef, branch, filter, forEach, wait and approval.
Einstellungen
Der Wert des Knotenfelds, mit diesen Einstellungen.
| Einstellung | Typ | Standardwert | Beschreibung |
|---|---|---|---|
itemserforderlich | string | - | Items is a placeholder naming a list, e.g. {read-sheet.rows}. |
maxItems | integer | - | MaxItems is the most items the list may have; the default is 100 and the most that can be asked for is 1000. |
enderforderlich | string | - | End is the node that closes the loop and runs once after the last item. It is where the body's last node points. |
Das vollständige JSON Schema dieser Einstellungen: forEach.schema.json.
Im Flow verwenden
flow.yaml
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
name: my-email-forward
namespace: tenant-acme
spec:
classRef: {name: email-forward}
config: {}
---
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
name: foreach-example
namespace: tenant-acme
spec:
displayName: "For each"
triggers:
- id: start
ref: {name: email-arrives}
connectorRef: {name: my-email-forward}
next: [sheet]
nodes:
- id: sheet
stepRef: {name: read-spreadsheet}
config: {headerRow: 1}
next: [rows]
- id: rows
forEach: {items: "{sheet.rows}", maxItems: 20, end: done}
next: [say]
- id: say
stepRef: {name: notify-in-app}
config:
to: admins
title: "Row {each.index}"
body: "{each.item}"
next: [done]
- id: done
stepRef: {name: notify-in-app}
config:
to: admins
title: "All {rows.count} rows done"
War diese Seite hilfreich?