Script Tags are tags which contain business logic scripts, that put into operation, during Runtime when generating output, the required business logic.
Script Tags can be added to Forms in the following manner:
- Scripts can be added to the document directly. When you add a script to a document it is added as empty.
A Script tag is represented by an icon. When a Script tag is empty of scripts, a red star,, is appended to the Script icon. The star disappears immediately after a script is saved in the tag.
- By Data Tag conversion –Data tags can be converted to Script Tags. The scripts are added as empty.
To directly add a Script tag to a document:
- In the Designer, click the document location for entering the Script Tag.
- In the Data Repository Data Tags panel, double-click Script Tag (or right-click Script Tag and click the Insert Script Tag button); the Script Tag Properties window appears.
- In the Tag Name field, enter a name for the script tag.
- Check the Hyperlink text box to enable adding an action URL address value.
- You can add script logic now or click OK to save the data tag as a script and add the script logic later.
When you save the new script tag it appears in the Data Tags/Form pane.
To convert a Data tag to a Script tag:
1. In the Form Data Tags panel, right-click (or double-click) the required Data Tag (a data tag that has already been placed into the document) and from the menu, select Properties; the Tag Properties window appears.
2. Select one of the following Tag Type options:
- Bar Code
To select Multimedia and Picture tags, complete the procedure and then in the new Script tag, access the Script Tag Properties window.
3. Click the Convert To Script Tag button.
4. You can add script logic now or click OK to save the data tag as a script and add the script logic later.
Adding Content to a Script
Before you start adding content to a script prepare the logical groundwork for the script – design the conditions, tag values, and images that comprise the script. For example, define what you want to happen if the condition is not filled.
The following script will be added to a form letter to be sent to the accounts. The script will enable one of two announcements to appear in the form letter.
- Delivery/Installation Status = “Completed”: will display the following symbol .”
- Delivery/Installation Status not “Completed”: will display the following symbol .
Following is an example of the steps of creating a text script. In addition to adding content, you also have the option to define Masking Types and Display Maximum Lengths.
Step 3: Defining Script Conditions
Define the condition(s) that must be met in order to enable the script to perform the defined activities.
To define conditions:
In the Script Editor Tree, under Statements, double-click If.
2. Define the first condition:
a. Click the left side of the equation; Expression is highlighted and Operand1 is enabled.
b. Select an Operand Type for Operand1. See ; The selected Operand Type appears on the left side of the Line equation.
c. Click the Operator sign in the Line area and select the Operator from the drop-down list.
d. Select an Operand Type for Operand 2; the selected Operand Type appears on the right side of the Line equation.
3. Click Save; the condition appears in the Script Editor.
To add a condition, right-click the operator and select Add Condition.
Add the required condition.
Step 4: Defining Script Actions
After conditions have been defined, you can define the actions that occur, when the conditions are met.
You can define actions as values (for example a message displayed to a user) or as symbols.
To create an action for when a condition is met – set value:
1. Select the condition.
2. In the Script Editor Tree, under Actions > Value, double-click Set Value; the Script Line Editor appears.
To create an action for when a condition is met – set symbol:
1. Select the condition.
2. In the Script Editor Tree, under Actions > Value, double-click Set symbol; the Symbol Editor
3. Select the appropriate image and click OK.
Repeat steps 1-3 for additional images.
Step 5: Modifying the Appearance of the Action Value
After defining an action value, you can modify the appearance of the value.
To customize the visual appearance of an action:
1. In the Script Editor Tree, double-click an Actions > Visual option (e.g. Font Attributes); the Visual Editor appears (in this scenario, Font Attributes appears).
2. Modify the Visual Editor according to need.
3. If necessary, double–click additional Action > Visual options and in the Visual Editor, modify according to need.
Step 6: Defining an Alternative Action
Define the alternate action or condition that occurs (either as a value or as a symbol), when the conditions are not met (optional action).
To define an alternative action:
1. In the Script Editor, select the condition.
2. In the Script Editor Tree, double-click Else; the Else line appears in the Script Editor pane.
3. You can do one or more of the following:
– Double-click Actions > Value > SET VALUE; the Line Editor appears. Set the condition. For example: for Operand 1, select Constant, add a message and click Save.
– Double-click Actions > Value > SET SYMBOL; the Set Symbol Line Editor appears. Select the symbol and click OK.
The additional action(s) appears in the Script Editor.
Step 7: Defining the Alternative Conditions
You can define alternative conditions when the alternative condition is met and when it is not met.
Step 8: Saving the script
When you have completed the script, click Save.
In the Script Tag Properties window click OK.
Step 9: Test Previewing the Scripts
You can test preview the script by setting the test values of each data tag to be previewed. After setting the data tags, run the preview. Correct if necessary.