Manipulating Template Variables
The Template Variable Manipulation Instructions used in a Component Step allows manipulation of the Template Variables in a Template.
This category includes two FieldLogs specific Script Instructions:
Flkw:GetTopTemplateVariable
Flkw:SetTopTemplateVariable
Flkw:GetTopTemplateVariable
is used inside a Component Step to retrieve the value of a Template Variable in the parent Template.
Format : Flkw:GetTopTemplateVariable('ComponentVariableName');
Parameter | Description |
---|---|
TopTemplateVariable | The name of the Parent Template Variable whose value is to be retrieved. |
To construct an enhanced Script Instruction using Flkw:GetTopTemplateVariable
:
Select JS Execute from the Instruction dropdown list. In the Expression field, enter the
Flkw:GetTopTemplateVariable
Instruction as shown.The
Flkw:GetTopTemplateVariable
Instruction is added to the Script associated with Step of ID 1.Note that this Instruction is added to the Component Template. The Template Variable must be linked to the Component Variable compVar.
At runtime, let us suppose that the user enters 13 as the Battery Main Voltage (Step of ID 1). The script retrieves the value and stores it in the Component Variable compVar.
The script then retrieves the compVar value 13 and displays it in the alert message as Value set in top template: 13
Flkw:SetTopTemplateVariable
is used inside a Component Step to set the value of a Template Variable in the parent Template.
Format : Flkw:SetTopTemplateVariable('ComponentVariableName');
Parameter | Description |
---|---|
TopTemplateVariable | The name of the Parent Template Variable whose value is to be set. |
To construct an enhanced Script Instruction using Flkw:SetTopTemplateVariable
:
Select JS Execute from the Instruction dropdown list. In the Expression field, enter the
Flkw:SetTopTemplateVariable
Instruction as shown.The
Flkw:SetTopTemplateVariable
Instruction is added to the Script associated with Step of ID 1.Note that this Instruction is added to the Template that is a Component Step of the Parent Template. The Template Variable is then linked to the Component Variable compVar
At runtime, let us suppose that the user enters 13 as the Battery Main Voltage (Step of ID 1). The script retrieves the value and sets it to the Component Variable compVar.