Skip to main content

FieldLogs

Global Value

The Global Value Instructions allow manipulation of the values of Global Variables and Template Variables.

Note

Global Variables are named values that are shared between different Scripts.

Local Variables are local to the Script/Block they are defined in.

Template Variables are named values accessible across the entire Template.

The Global Value category includes four types of Script Instructions:

  1. Get Global Value

  2. Set Global Value

  3. Get Template Variable Value

  4. Set Template Variable Value

Get Global Value is a Global Value Instruction that retrieves the value of a Global Variable and stores it in a Local Variable.

To construct a Script Instruction using Get Global Value:

  1. Select Get Global Value from the Instruction dropdown list. Options Variable Name and Global Variable appear as seen below.

    GetGlobalValue1.png
  2. Enter the name of a Local Variable in the Variable Name field. Choose the Global Variable whose value needs to be retrieved from the Global Variable dropdown list.

    In the below example:

    At runtime, the value of the Global Variable VoltageSlabDenominator is retrieved and stored in the Local Variable vsDenominator.

    GetGlobalValue2.png

    The Get Global Value Script Instruction is added to the Script.

    GetGlobalValue3.png

Set Global Value is a Global Value Instruction that sets the value of a Global Variable. It executes a JavaScript expression and sets the result as the value of the Global Variable.

To construct a Script Instruction using Set Global Value:

  1. Select Set Global Value from the Instruction dropdown list. Options Global Variable and Expression appear as seen below.

    SetGlobalValue1.png
  2. In the Global Variable field, enter the name of the Global Variable that would store the result of the Expression.

    In the Expression field, enter the JavaScript expression whose result needs to be set as the value of the Global Variable.

    In the below example:

    At runtime, the Global Variable VoltageSlabDenominator is created and it holds the value 10.

    SetGlobalValue2.png

The Set Global Value Script Instruction is added to the Script.

SetGlobalValue3.png

Get Template Variable Value is a Global Value Instruction that retrieves the value of a Template Variable and stores the value in a Local Variable.

To construct a Script Instruction using Get Template Variable Value:

  1. Select Get Template Variable Value from the Instruction dropdown list. Options Variable Name and Template Variable appear as seen below.

    GetTemplateVariableValue1.png
  2. Enter the name of the Local Variable in the Variable Name field. Choose the Template Variable whose value needs to be retrieved from the Template Variable dropdown list.

    In the below example:

    At runtime, the value of the Template Variable DefaultVoltage is retrieved and stored in the Local Variable tempVoltage

    GetTemplateVariableValue2.png

The Get Template Variable Value Script Instruction is added to the Script.

GetTemplateVariableValue3.png

Set Template Variable Value is a Global Value Instruction that sets the value of a Template Variable. It executes a JavaScript expression and sets the result as the value of the Template Variable.

To construct a Script Instruction using Set Template Variable Value Step:

  1. Select Set Template Variable Value from the Instruction dropdown list. Options Template Variable and Expression appear as seen below.

    SetTemplateVariableValue1.png
  2. Choose the Template Variable whose value needs to be set in the Template Variable dropdown list.

    In the Expression field, enter the JavaScript expression whose result needs to be stored in the Template Variable.

    SetTemplateVariableValue.png

    In the example:

    At runtime, the Set Template Variable Value Instruction sets the value of the Template Variable EnteredBatteryVoltage with the result of the expression var(enteredVoltage) - 10

    The Set Template Variable Value Script Instruction is added to the Script.

    SetTemplateVariableValue3.png