Introduction

Scripts enable implementing the business logic of output generated during Runtime.
Scripts are added while creating or modifying the Form. Script conditions are designed in the Script Editor and embedded into Scripts.
Scripts enable performing actions with application data and document content, on the basis of conditional logic and/or calculations, and preclude the need for programming. Such activity can be:

  • Visually changing the appearance of a value in the data tag, (e.g. enlarging text for accessibility purposes, color-coding text etc).
  • Modifying text on the basis of condition changes and inserting pictures or multimedia (e.g. marketing messages or images that change according to platinum, gold, or silver customer types).
  • Calculating operation with tag values.
  • Applying various logical or mathematical functions (e.g. trim, round, absolute).

Scripts can be used in Forms and Segments.

Script Logic

Begin script creation by defining a Statement of a condition (e.g. customer account numbers should be greater than 1000).

  • Continue script creation by defining what happens when:
  • The condition is met (e.g. the customer Account number is greater than 1000), you define that a certain Action takes place in the form.

Additionally, in place of an alternative action, there can be an alternative condition that leads to the alternative action.

  • You define a condition (e.g. customer account numbers should be greater than 1000).
  • If the customer account number meets the condition (e.g. is greater than 1000), you define that a certain action takes place in the form.

This methodology can be used to edit scripts found in various tag types:

  • Text Type
  • Picture Type
  • Barcode Type
  • Multimedia

Getting Started with Scripts

There are two main windows with which you should familiarize yourself before starting to add scripts to Forms:

The Script Editor window provides easy tools for converting the logic into a script

The Script Line Editor which provides tools for writing the script lines.

Script Editor

The Script Editor window provides the tools for creating new scripts and editing scripts.

The Script Editor includes the following panels:

  •  – Script Editor Statement / Actions Trees: depend on script type
  •  – Editor Panel toolbar: Tools to fine tune the script information appearing in Editor panel:
    o  Move Row Up – Move the selected row up in the Editor panel.
    o  Move Row Down – Move the selected row down in the Editor panel.
    o  Zoom Increase – Increase the font size of information in the Editor panel.
    o  Zoom Decrease – Decrease the font size of information in the Editor panel.
    o  Delete – Delete an entire row from the Editor panel.
  •  – Editor panel: Enter script here
  •  – Data tag name
  •  – Click to save the script

Script Editor Statement / Actions Trees

There are varying options in the Script Editor trees, depending on the script type.
The Script Editor tree contains the following script controls:

When you click a script control, the Line Editor appears with the appropriate tools.
See Script Line Editor Functions.

Statements:

  • Comment – For the user-editor, enables entering a statement into the Editor Pane that describes the intentions of the specific script.
  • If (Condition)– Enables entering an initial statement that describes under what condition the script functions.
  • Else If (Condition) – A combination of If and Else. Enables entering an additional statement that describes under what condition the script functions when the If condition is not met.
  • Else (Condition)– Enables entering a statement that describes what happens when the If and Else If conditions are not met.

Text Actions:

Value:
 – Set Value (Expression) – Enables entering a script expression based on the conditions applied to the data tag value.
 – Set Symbol – Enables entering a symbol into the script applied to the selected data tag

Visual:
 – Set Font Attributes – Accesses the Font Attributes window for modifying all font attributes.
 – Set Font Color – Accesses the Color window for modifying font color.
 – Set Font Typeface – Accesses the Font typeface window for modifying the font typestyle.
 – Set Font Weight – Accesses the Font Weight window for modifying font weight.
 – Set Font Size – Accesses the Font Size window for modifying font size.
 – Set Font Slant – Accesses the Font Slant window for italicizing the font.
 – Set Font Underline – Accesses the Font Underline window for underlining the font.

OTHER ACTIONS

Bar Code Data Tag Actions:
Value:
 – Set Value – Enables entering a required bar code into the document.

Multimedia Tag Actions:
Value:
 – Insert Media Source – Enables entering, into the Form, a link to a designated multimedia source.

Picture Data Tag Actions:
Visual:
 – Insert Picture – Enables entering graphic elements into the Form (i.e. pictures as image files) on the basis of predefined conditions.

Script Line Editor

The Script Line Editor appears when you double-click any of the following Statements or Actions options in the Script Editor Tree:

  • If
  • Else If
  • Set Value

The If and Else If statements are used to check whether a relation between two expressions (i.e. A>B) is true and dynamically determine a value for the scenario field. If the value is true, the commands below the If statement are executed. If the value is not true (i.e. A<=B) the commands below Else statement (if they exist) are executed.

The Set Value action is a result of a true/false statement and enables setting a value dynamically.

From the Script Line Editor, you can define the conditional logic or the values on the basis of the Script Tag changes, expressions with Script tags and constants, operands, and functional usage.

The Script Line Editor Main window comprises the following elements:

Line – Statement area

The Line area enables you to design the script logic, using options from the Edit Expression panel. Right-click inside the text box to add /delete expressions or conditions.

Edit Expression

When you click an expression in the Line area the Edit Expression area is enabled.

Help Pane

The Help pane provides an explanation of the selected Operand type. In addition, it provides an explicit explanation of each of the Function options.

Line If/If Else – Statement

The Line area for If/Else If enables you to design the script logic, using options from the Edit Expression panel.

A basic Statement line displays an Operand 1 option, an operator, and an Operand 2 option.

Right-click inside the text box to add /delete expressions or conditions.

When you select an operand or operator in the Line area, the Edit Expression area is enabled.

The Edit Expression panel displays the following elements:

  • Operands – Units of data upon which the mathematical or logical operation is performed.
  • Operator – Symbol that signifies a logical or mathematical operation between data units (operands).
For a full list of expressions and operands available in the Designer, click here:  Script Line Editor Functions.

Operand Types

The following operand types are available:
Data Tag – Dropdown menu that displays all of data repository tags in the form or project (based on the data repository type). Select the Data Tag that will appear as the Operand in the Line; the data value that would be incorporated in the tag during form generation, will be used in the script.

 – Constant – Enter a string of numbers and/or letters, which will appear as the Operand in the Line.
 – Function – Define a function of the Operand (e.g. append strings, apply Absolute functions to numbers, round up/down number, etc).
When you select a function the Help pane displays a description of the function.
 – Expression – Combination of explicit values, constants, variables, operators, and functions that are interpreted according to specific rules that enable computing and then producing other values. The value can be composed of numerical, string, logical types etc.

Operator

Operators enable creating the logical equations that form the basis of the scripts.

Mathematical Operators:

Operators include the following symbols:
=      Operand1 is equal to Operand2.
< >   Operand1 is not equal to Operand2
 >      Operand1 is greater than Operand2.
<      Operand1 is less than Operand2.
>=    Operand1 is greater than or equal to Operand2.
<=    Operand1 is less than or equal to Operand2.

Logical Operators:

AND  Both operands must be true for the expression to be true.

OR      If either operand is true, the expression is true.

You are now ready to start adding scripts to your Forms!