LetsFlow
Search…
Data instruction
Data instructions allow you to dynamically set properties of a state or actions when they are instantiated using data from the projected process.
  • <ref> - Resolve a reference to another part of the document using a dot key path
  • <ifset> - Checks if a reference is null. If so, replace the object by null.
  • <switch> - Choose one of the child properties based on a property in the document
  • <merge> - Merge a set of objects
  • <enrich> - Enrich an object with extra data by matching properties
  • <tpl> - Parse text as Mustache template
  • <apply> - Project an object using the JMESPath query language
  • <dateformat> - Takes a date and a format (defaults to Y-m-d) and formats the accordingly. Optionally you can set the timezone if you wish to output timezone information.

Example

1
{
2
"foo": {
3
"bar": {
4
"qux": 12345
5
},
6
"term": "data enrichment",
7
"city": "Amsterdam",
8
"country": "Netherlands"
9
},
10
"amount": {
11
"<ref>": "foo.bar.qux"
12
},
13
"message": {
14
"<tpl>": "I want to go to {{ foo.city }}, {{ foo.country }}"
15
},
16
"shipping": {
17
"<switch>": {
18
"on": { "<ref>": "foo.country" },
19
"options": {
20
"USA": "UPS",
21
"Netherlands": "PostNL"
22
},
23
"default": "DHL"
24
}
25
},
26
"user": {
27
"<src>": "https://api.example.com/users/9870"
28
},
29
"search_results": {
30
"<apply>": {
31
"projection": "RelatedTopics[].{url: FirstURL, description: Text}",
32
"input": {
33
"<src>": {
34
"<tpl>": "http://api.duckduckgo.com/?q={{ foo.term }}&format=json"
35
}
36
}
37
}
38
},
39
"profile": {
40
"<merge>": [
41
{
42
"<ref>": "foo.bar"
43
},
44
{
45
"<hash>": {
46
"algo": "md5",
47
"input": "foo"
48
}
49
},
50
{
51
"apples": 100,
52
"pears": 220
53
}
54
]
55
}
56
}
Copied!
Last modified 2yr ago
Copy link
Contents
Example