Skip to main content

FieldLogs

Logic

The Logic category allows constructs like conditional execution and loops inside Script Instructions. There are two types of logical constructs that can be used in Scripts.

  1. Conditional Statement: If (...) {} else {}

  2. While Loop: While () {...}

If (...) {} else {} : This construct executes a set of Instructions if the specified condition is met, and a different set of Instructions otherwise.

To use the If (...) {} else {} construct in a Script:

  1. Select the If (...) {} else {} from the Instruction dropdown list.

    ifelse1.png

    An If (...) {} construct is introduced into the Script.

  2. Enter a JavaScript expression that evaluates the required condition in the If Condition field. The expression must evaluate to a Boolean TRUE or FALSE.

    ifelse2.png
  3. Click Add Then Instruction to add the set of Script instructions to be executed if the condition evaluates to TRUE.

    ifelse3.png

    Select any instruction that needs to be executed if the condition evaluates to TRUE. You could also introduce a Block Structure to encompass a set of Instructions.

    ifelse4.png
  4. Click the Add Else Instruction to add the Script Instructions to be evaluated if the condition evaluates to FALSE.

    ifelse5.png

    Select any instruction that needs to be executed if the condition evaluates to FALSE. You could also introduce a Block Structure to encompass a set of Instructions.

    ifelse6.png

An If (...) {} else {} construct is added to the Script.

ifelse7.png

While () {...} : This construct defines a While Loop.

It repeats the execution of a set of Instructions until the defined condition evaluates to FALSE. Before each Iteration, the condition is evaluated. If the condition evaluates to TRUE, the Block of Instructions is executed one more time. If the condition evaluates to FALSE, the execution stops.

To construct a Script Instruction using While () {...}:

  1. Select While () {...} from the Instruction dropdown list.

    while1.png
  2. A While () {...} construct is introduced into the Script. Enter a JavaScript expression that evaluates the required condition in the While Condition field. The expression must evaluate to a Boolean TRUE or FALSE.

    while2.png
  3. Click Add Instruction to add the set of Script instructions to be executed if the condition evaluates to TRUE.

    while3.png

    Select any instruction that needs to be executed if the condition evaluates to TRUE. You could also introduce a Block Structure to encompass a set of Instructions.

    while5.png

A While () {...} construct is added to the Script.

while6.png