Variable Insertion (Interpolation) is a way to dynamically modify a string expression , or object at runtime.
Usage Engine uses curly brackets to indicate that a Variable Insertion will take place. The variable insertion is supported in some Functions' configuration fields and also within Script and Script Aggregator Functions.
Within the curly brackets, you can access variables that belong to different scopes and use them to generate a dynamically changed output at runtime. Depending on what you want to achieve or manipulate, the output from Variable Insertion can be a string, (if prefixed by '$') or an object( if prefixed by '@' ).
...
- payload
- meta
- deploy
- sharedStore
Refer to the 7861678 below table below to know how to use these scopes and some examples for understandingwith a few examples. You can also perform nested Variable Insertion using the same or different scopes.
...
Info | |||||
---|---|---|---|---|---|
| |||||
While using '$' or '@', you need to remember note the following:
For example:Example |
Variable Insertion with Scopes Anchor table table
table | |
table |
Variable Insertion with Scopes
You can use Variable Insertion using the following scopes/variables/objects only:
Scope | Explanation | Example | |||||||
---|---|---|---|---|---|---|---|---|---|
You can perform Variable Insertion on any data from the current record.
|
To access or, if you want to use nested Variable Insertion, you can use square brackets '[]' ${payload.allFruits[apple]} ---> The result will be 2 | ||||||||
meta | Meta covers additional information that gives further context to the data (metadata).
You can use Variable Insertion using any data from the current record's metadata. You can use
| For example, If if you want to try to read from an Amazon S3 Forwarder Function using a Script Function:
And, do Variable Insertion on the filename: Once you run the stream, you will find the files in S3 Forwarder with the following format: | |||||||
deploy | You can use Variable Insertion using replicaNumber and lastReplicaNumber properties only.When running a stream with multiple replicas, the first instance would be identified as the first replica. This is represented in the The For more information about replicas, see Performance and scalability. | For example, To access the second instance of a replica with a total of three instances running:
You can use Variable Insertion like:
| |||||||
sharedStore | Data that is currently stored in the shared store. The The Refer Script for more information. |
|
...