oto/assets/yaml/example/foreach.yaml

59 lines
No EOL
1.1 KiB
YAML

---
property:
workspace: .
arr1:
- This is message 1
- This is message 2
- This is message 3
- This is message 4
map:
test1: This is message 1
test2: This is message 2
test3: This is message 3
test4: This is message 4
arr2:
- innter arr message 1
- innter arr message 2
- innter arr message 3
- innter arr message 4
pipeline:
id: main
workflow:
# list foreach
- foreach:
iterator: <!property.arr1>
setValue: <@property.element1>
on-do:
- exe: print1
# innter foreach
- foreach:
iterator: <!property.arr2>
setValue: <@property.element2>
on-do:
- exe: print2
# map foreach
- foreach:
iterator: <!property.map>
# setKey is optional
setKey: <@property.keyName>
setValue: <@property.element>
on-do:
- exe: print3
commands:
- command: Print
id: print1
param:
message: <!property.element1>
- command: Print
id: print2
param:
message: <!property.element2>
- command: Print
id: print3
param:
message: <!property.keyName> - <!property.element>