Template


The Template node populates a template with data from the input msg and outputs the populated template as the output msg.

Node Type

EnOS.

Input and Output Ability

This node has 1 entry point and 1 exit point. Both the input and output are JSON.

Node Properties

../../_images/template.png


Name

The name for this node.


Format

The format of the template. After selecting the format, you can edit the details in Content if needed.

  • Measurement Point template: Contains parameters such as assetId, time, and measurepoints.

  • Command temmplate: Contains parameters such as commandId, code, message, and data.

  • Custom: Contains no parameters. You can customize the format from scratch.


Content

The content of the template which can be edited. Use expressions such as ${msg.commandId} to get the information from the input msg to populate the template content. For more information on expressions, see Expressions.


Description

The description for this node.

Samples

Template Content Sample

{
  "assetId":"${msg.assetId}",
  "time":"$dateUtil.to_timestamp(\"${msg.time}\", \"yyyy-mm-dd HH24:mm:ss\")",
  "measurepoints":{
    "${msg.pointName}":"${msg.value}"
  }
}

Input Sample

{
  "assetId":"device0001",
  "time":"2021-02-27 18:00:00",
  "pointName":"converter001",
  "value":"200"
}

Output Sample

{
   "assetId":"device001",
   "time":"1614420000000",
   "measurepoints": {
      "converter001":"200"
    }
}