Template Builder User Guide

Version 3.1 | Published June 26, 2024 ©

Environment Variables

In Template Builder there are some built-in system environment variables, and it is also possible to define your own environment variables through URL parameters to the application. These URL parameters must also be added to the Viz Pilot Edge URL when templates and data elements are using these variables. If a variable is used, but not defined, it is possible to set a default value.

Defining Environment Variables

The application defines the following application specific environment variables:

Variable

Value

$APP

"TemplateBuilder" or "PilotEdge".

$PDS

URL to the Pilot Data Server.

$GH

URL to the configured Graphic Hub for scenes.

It is also possible to define custom environment variables to be used in the templates. These variables can be specified as URL parameters to the application. Environment variable in the URL must use the format $var=value, where the name of the variable must start with a dollar sign and the value is set after the equal sign. There can be multiple environment values specified. For example, if the variable version can be specified like this in URL to the application http://mypds:8177/app/templatebuilder/templatebuilder.html?$version=v1, then the value of the variable version can be used when specifying URLs to HTML panels, in feed URLs, expressions and auto title formatting.

Using Environment Variables

In general, the notation for using environment variables is {$var|default}, where var is the name of the variable and default is the default value if the variable is not defined.

When using an environment variable in a URL, the URL must be prepended with "{$}" if it does not start with an environment variable.

See the examples below:

Scenario

Example

Description

URL to HTML panel or full HTML page

{$} http://mywebserver/templatepanels/{$version|v1}/mypanel.html

The full URL used by the application is http://mywebserver/templatepanels/v1/mypanel.html if the environment variable version is not defined in a URL parameter.

URL to a feed of objects from graphic hub

{$GH} /files/BAA340C1-C71E-0949-BCF6-F7E043856030/

The {$GH} environment variable contains the full URL to the Graphic Hub and certifies that if the system is configured to point to another Graphic Hub, the link still works.

Inside HTML fragments

<img src="{{$PDS}}/pilotedge-3.0/vizPilotEdgeLogo.svg">

Note the double brackets around the variable.

Inside HTML fragments

{{$APP}} <br>
{{$PDS}} <br>
{{$GH}}

Writes out the application specific environment variables.

Auto generated title format

{field1} / {field2} ({$version|DEV})

Concatenates the values of field1 and field 2 and the word DEV, if version is not defined in a URL parameter.

In expressions

{{$APP}}==="TemplateBuilder"

Note the double brackets. This can hide a field if the template is opened in Template Builder, when added to the "Hidden expression" for a field in the field editor.