Skip to main content
Version: 4.46.0

Template Engine

This component allows you to format data using a Handlebars template. The result will be a rendered template based on the input. it can be used to template JSON, XML, CSV, and HTML files.

Configuration

Template

A language-agnostic template syntax. Multiple templates are available from the dropdown menu, they are divided into categories:

  • Migration (JSON): Referring to Xill4 data model.
  • ToPX (XML): Referring to ToPX data model.
  • SPO (XML): Referring to Sharepoint Online data model.

Choose the option empty to use an empty template, all templates are editable though.

Handlebars

This component lets you use Handlebars templates. More information about Handlebars can be found in this section

Output JSON result only

Removes the incoming message from the output.

Parse JSON result

When using templates that contain JSON objects, you can check Parse JSON result to output objects instead of strings.

Parse ISO dates

Enables auto parsing of ISO dates to a date object.

Xsd schema (Validation)

By default no validation is selected, validation is added to outgoing messages by selecting one of the schemas in the dropdown. If the validation fails, the outgoing message will be sent to the error output.

No validation No validation on the templates Custom Add an own customized schema ToPX 2.3.1 ToPX 2.3.1 xsd-schema

Inputs

Input

An object containing the values for template variables, conditions, loops or filters. The following input is used for two different custom example templates:

Example input

{
"_id": "12345",
"kind": "BINARY",
"migration": {
"migrate": true
},
"source": {
"rawExtension": "xlsx",
"extension": "xlsx",
"byteSize": 5943,
"properties" : {
"category" : [1,2,3]
}
}
}

Example template XML

<?xml version="1.0" encoding="utf-8"?>
<file>
<kind>
"{{ kind }}""
</kind>
</file>

Example template JSON

{
"_id": "{{_id}}",
"kind": "BINARY",
"migration": {
"migrate": true
},
"source": {{stringify source}},
"target": {
"rawExtension": "{{source.rawExtension}}",
"extension": "{{source.extension}}",
"byteSize": {{source.byteSize}}
}
}

Outputs

Output

Rendered template based on the input and configuration used above.

Example Output JSON

{
"value": {
"_id": "12345",
"kind": "BINARY",
"migration": {
"migrate": true
},
"source": {
"rawExtension": "xlsx",
"extension": "xlsx",
"byteSize": 5943,
"properties": {
"category": [1,2,3]
}
}
},
"result": {
"_id": "12345",
"kind": "BINARY",
"migration": {
"migrate": true
},
"source": {
"rawExtension": "xlsx",
"extension": "xlsx",
"byteSize": 5943,
"properties": {
"category": [1,2,3]
}
},
"target": {
"rawExtension": "xlsx",
"extension": "xlsx",
"byteSize": 5943,
"properties": {
"category": [1,2,3],
"taxonomy": "default"
}
}
}
}