Dynamic evaluation
Capabilities
Capability |
Support |
Comment |
|---|---|---|
Extract a single element |
||
Extract a list of elements |
||
Use schema with dynamic elements |
||
Use complex JSON path query for dynamic evaluation |
Context
Web evaluation involves using user input alongside integrator logic. It serves various purposes across multiple components :
Menus and toolbars
Schematics
On-clicks handler on widgets
…
To evaluate expressions, the web performs these steps:
Find all dynamic expression placeholder (between
${and}).Replace all
${<dynamic content replacement>}available during evaluation. Missing items are replaced by empty strings. JSON structure can be access through.separator (ie.${user.username}).Evaluate and retrieve its content for further usage. Should an error occurs, resulting evaluation returns an undefined result.
Evaluation language is JavaScript and supports syntactic sugar such as object?.hypotheticalAccessor.
Building dynamic data is done through pipeline evaluation with the following steps:
Extraction with
extractkeyword. This allows context value extraction using JSONPath query. Resulting extraction will always be an array of elements. Context parts can be extracted and sent with theextractkeyword.Evaluation with
expressionkeyword. This allows JavaScript code evaluation. Returns the evaluation result.Transformation with
askeyword into the desired type.
Extracting from single item
In the following example, the your-variable field is filled with extracting content from context.field.dynamic. Since extraction result is an array, we transform it with as transformer. The static field will be filled with this is static content.
{
"input": {
"your-variable": {
"extract": "context.field.dynamic",
"as": "string"
},
"static": "this is static content"
}
}
Extraction of a list of items
{
"tags": {
"extract": "rows.clicked.tags[*]",
"as": "string"
}
}
Extraction of a map of key values given the schema
Given the schema :
{
"additionalData": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
}
Use the condition :
{
"additionalData": {
"extract": "rows.clicked.additionalData[*]",
"expression": "${extraction}.reduce((accumulator, currentObject) => { return { ...accumulator, [currentObject?.key]:currentObject?.value }; }, {});"
}
}