Click or drag to resize
[Calculated] section
Print this page

The [Calculated] section lets you define a function that operates on input data. For each name/value pair in this section:

  • The name portion declares a calculated variable.
  • The value portion defines the input or function that specifies the value of the calculated variable.

This topic contains the following sections:


On the right-hand (value) side, the calculation you define can use one or more of the built-in functions, plus any of these operators:

  • Addition ( + ).
  • Subtraction ( - ).
  • Multiplication ( * ).
  • Division ( / ).
  • String concatenation ( || ).
  • If-then-else. (? :)
Example: Addition
TotalWeight = Input.EmptyWeight + Input.LoadWeight

This defines a calculated variable named TotalWeight, which you can use in the [Filter] section or [Output] section.

Example: If-then-else

You can also define a calculated variable using an if-then-else (ternary) operator.

In this example, a CalculatedSpeedUnit variable is used to dynamically set the units used for the LastLocationSpeed column based on the value of the BaseAddress column’s Country subfield:

  • If the BaseAddress country is USA, then CalculatedSpeedUnit is set to mph.
  • Otherwise, CalculatedSpeedUnit is set to kph.
TemplateVersion = 1.0
TableID = Unit-1.0
TemplateName = RetrieveUnit
Intent = Retrieve
OrderBy = Input.Tag
Format = JSON

CalculatedSpeedUnit = Input.BaseAddress.Country == "USA" ? "mph" : "kph"

Tag = Input.Tag
Id(test) = Input.Id
DriverName  = Input.DriverName
DriverId = Input.DriverId
BaseAddress = Input.BaseAddress
LastLocationSpeed(CalculatedSpeedUnit) = Input.LastLocationSpeed

Variables you set in the [Calculated] section can be used in the Filter or Output sections.