Skip to main content

FieldLogs

Global Value

The Global Value Instructions retrieves/sets the values of Global Variables.

Global Variables are different from Template Variables.

Template Variables are visible to users for assignment. However, Global variables are used exclusively in Scripts and they are not visible for assignment to users. They can be used when it is required to pass information between Scripts that need not be made visible to the user.

Note

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

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

This category includes two Fieldlogs specific Script Instructions:

  1. Flkw:GetGlobalVariableValue

  2. Flkw:SetGlobalVariableValue

Flkw:GetGlobalVariableValue retrieves the value of a Global Variable and stores it in a Local Variable.

Format :  Flkw:GetGlobalVariableValue('GlobalVariableName');

Parameter

Description

GlobalVariableName

The name of the Global Variable whose value is to be retrieved.

To construct an enhanced Script Instruction using Flkw:GetGlobalVariableValue:

  • Select JS Execute from the Instruction dropdown list. In the Expression field, enter the Flkw:GetGlobalVariableValue Instruction as shown.

    GetGV1.png

    The Flkw:GetGlobalVariableValue Instruction is added to the Script associated with Step of ID 2. It accesses the Global Variable GVstdVoltage that was set in a different Script associated with Step 1.

    At runtime, this script, gets the value (440) of the Global Variable GVstdVoltage and stores it in a Local Variable stdVoltage after the Step 2 is validated.

    GetGV2.png

    The Script also validates the Step 3 of the Template with this value 440 as seen below.

    GetGV3.png

The Flkw:SetGlobalVariableValue sets the value of a Global Variable.

Format :  Flkw:SetGlobalVariableValue('GlobalVariableName','value');

Parameter

Description

GlobalVariableName

The name of the Global Variable whose value is to be set.

value

The value to be set.

To construct an enhanced Script Instruction using Flkw:SetGlobalVariableValue:

  • Select JS Execute from the Instruction dropdown list. In the Expression field, enter the Flkw:SetGlobalVariableValue Instruction as shown.

    SetGV1.png

    The Flkw:SetGlobalVariableValue Instruction is added to the Script associated with Step of ID 1.

    This instruction creates a Global Variable GVstdVoltage and assigns a value 440 to it. This Global Variable GVstdVoltage is now available to Scripts associated with other Steps of the Template.