ScriptPro Editor

This topic is for use by scriptwriters who are using ScriptPro Editor to create custom scripts for their agencies.

Agents can go to Using ScriptPro Scripts for more information about using custom or standard scripts within Travelport Smartpoint.

 

Variables

A Script can contain an unlimited number of variables (symbolic names representing values that can be different every time the script is executed).

Script variables are either local, global or context global depending on whether the variable is used within a script or by more than one script.

Variable scope

The three types of variables and the characteristics of each are listed below.

Variable Type

Characteristics

Local

  • Any variable declared defaults to local.

  • Local variables are "local to the script", i.e., they are available to all routines within a script.

  • When another script is "chained" to or "called", any variables declared in the calling script are not available to the chained or called script.

Global

  • Available to any script that has declared that variable and is used during the current instance of Smartpoint.

  • Remain available until the Smartpoint is exited.  At that time, their values are cleared from memory.

  • Must be declared in each script using them and be declared as the same type.  Successive declaration values for the variable are ignored once the variable has been initially declared and assigned a value in that first declaration.

  • Global variable names begin with an ampersand (&).  See Variable Names below.

Note:  A global variable's value is not changed by declaring it in the VARIABLES table of another script.  The subsequent script assumes the current value of the global variable.  A new value may be assigned in the subsequent script.

Context Global

  • Same as Global variables, but are only global for the life of a specific script and the scripts it calls or chains to which also use that global.

    Example: Used for such items are the arrival city used by an AIR script to sell a flight and by a CAR script to book a car in that same city.  The data remains intact in the chained and called scripts but would not need to be retained until exiting Smartpoint.

  • Context global variable names begin with a dollar sign ($).  See "Variable Names", below.

Variable names

All variables are upper and lower case sensitive.  No spaces are allowed. A number cannot be the first character of a variable name.

Example: date_variable and DATE_variable would be treated as separate variables.

Reserved words cannot be used as variable names. 

Global variable names begin with an ampersand (&) and must be declared in all scripts that use that variable as same name and type.

Format: &variablename

Context Global variable names begin with a dollar sign ($) and must be declared in all scripts that use that variable as same name and type.

Format: $variablename

Variable name length and permitted characters

User-defined variable names can be up to 4080 characters of alphabetic and/or numeric characters including the underscore (_).

Dialog Box input types

The five Dialog box input types are declared as follows in the Script's Variable Table:

  • Alphanumeric""
  • Numeric0
  • Date (mm/dd/yy)'00/00/00'
  • Airdate (ddmmm)'00XXX'
  • ANSI""

Variables used in dialog boxes are automatically added to the variables table when the dialog is transferred into the script, but are not automatically deleted if the dialog box is removed from the Script.

Variables used as a FLAG

FLAG

A FLAG is Boolean value variable and is used to check for existence of a particular condition or event. When part of a code is completed, the flag is turned on (1) to indicate that certain operations have been executed.

Analogy

On Halloween, if the lights are on (flag=1) at a house, you go to that house for candy.  If the light is off (flag=0), you go to the next house.

Used with CASE

FLAG is not a command, but is declared as a variable (flag = 0) in the variable declaration area of your script.  It is most often used with CASE statements.  In particular, flags are used when other choices might exist besides the choices in a CASE statement.

Example: A CASE statement may involve a list of preferred hotels.  If one of the hotels is selected, the FLAG will be turned on (flag = 1).  If none of the hotels in the CASE statement are selected, the FLAG will remain off (flag = 0).  The script would then allow the user to input a different selection.