Variable insertion
Unknown Attachment
Variable insertion (also known as interpolation) dynamically modifies string expressions or objects at runtime.
UsageCloud uses curly brackets to indicate variable insertion. It is supported in configuration settings for many functions, including Script, Script aggregator, and various forwarder functions.
Within the curly brackets, you can access variables from different scopes and use them to generate dynamically changed output at runtime. The output type depends on the prefix used:
$prefix: Returns a string representation@prefix: Returns the object value directly
Functions supporting variable insertion
Variable insertion is available in configuration settings for many functions. The specific fields that support interpolation are described in each function's documentation. Common functions that support variable insertion include:
Script - and Script aggregator to reference
payload,meta, andsharedStoredata in JavaScript code by using${}and@{}.Database - to insert values from the payload into SQL statements.
Amazon S3 forwarder - to create dynamic folder paths and filenames.
HTTP client - to build target URLs, query parameters, headers, and request bodies.
Email notification - to build dynamic values in the From, Recipients, Subject, and Message fields.
See the documentation for each function to see which configuration fields support variable insertion.
Supported scopes
UsageCloud supports variable insertion using the following scopes:
Scope | Description | Availability |
|---|---|---|
payload | Data from the current record flowing through the stream | Processor and forwarder functions only |
meta | Metadata providing additional context about the data | Processor and forwarder functions only |
sharedStore | Data stored in the shared store, loaded at stream start | All functions |
See Variable insertion scope details for more information.
This section has the following subsections: