Template placeholders address cases where most of a module's configuration should be used multiple times but some settings need to be customized (e.g. the name of a module).
Template placeholders allow defining parameters/variables that are valid within the template. Values for these placeholders need to be provided when the template is used:
- Placeholders can be defined in the template's
Placeholderssection. - For each placeholder, a name needs to be specified. The name must follow the common naming rules (see Element Names).
- In a template's content, a reference to a placeholder can be used instead of an inline value.
A reference to a placeholder is a string with the format
${NAME}, whereNAMEis the name of the placeholder defined in the template'sPlaceholderssection.
The following example extends the example from above with the use of placeholders:
- Instead of specifying a fixed module name and output address in the template, two placeholders named
ModuleNameandOutputAddressare defined. - In the template's content, these placeholders are used for the module's
NameandOutputAddresssettings.
{
"Templates": {
"Modules": [
{
"Name": "DQ_Template",
"Placeholders": [
{ "Name": "ModuleName" },
{ "Name": "OutputAddress" }
],
"Content": {
"Name": "${ModuleName}",
"TypeIdentifier": {
"OrderNumber": "6ES7 522-1BL01-0AB0",
"Version": "V1.1"
},
"IoConfiguration": {
"OutputAddress": "${OutputAddress}"
}
}
}
]
}
}