Variables
Variables
Variables allow DTPR elements to be customized when they are deployed in a specific datachain instance. They enable reusable element templates that can be tailored to individual use cases.
How variables work
Variables are defined at two levels:
- Element-level variables — Defined in the element's
variablesarray - Category-level variables — Defined in the category's
element_variablesarray and inherited by all elements in that category
Each variable has:
id— A unique identifier (e.g.,additional_description,duration)required— Whether the variable must be provided when deploying the elementlabel— A localized label for the variable (locale array format)
Variable interpolation
Element descriptions can reference variables using double curly brace syntax:
{
"description": [
{
"locale": "en",
"value": "This system stores data for {{duration}} and {{additional_description}}"
}
]
}
When an element is instantiated in a datachain, the variable placeholders are replaced with the instance-specific values.
Instance variable values
When deploying an element in a datachain, variable values are provided in the instance:
{
"instance": {
"priority": 0,
"variables": {
"additional_description": [
{
"locale": "en",
"value": "This technology can also capture audio data."
}
],
"duration": [
{
"locale": "en",
"value": "30 days"
}
]
}
}
}
Variable values for user-facing text follow the same locale array format as other DTPR content, enabling per-language customization.
Category-inherited variables
Categories can define variables that are available to all elements within that category. For example, a retention category might define a duration variable that every retention element can use.
These category-level variables appear in the element's variables array in API responses, merged with any element-specific variables.