Setting Variable Values
It is important to understand the difference between the two methods of assigning values to variables:
•The $var_def command essentially defines the initial value of a variable. With the exception of a few special names, a value specified which contains other variable references is never evaluated to expand these variables.
•The $set_var command dynamically assigns a new value to a variable. A value specified which contains other variable references is always evaluated to expand these variables.
The $var_def command can be used in the configuration file (CFG), the user profile (USR) or user properties (UJP) file, an FS file, or an MCF file:
|$var_def [CFG]||These variables are permanently defined and never change. However a later assignment to a variable of the same name takes precedence and can therefore override the value for the duration of a single call.|
|$var_def [USR, UJP]||These variables are established at the start of each call. However an assignment to a variable of the same name during the call takes precedence and can therefore override the value for the duration of call. They do not survive the end of the call.|
|$var_def [FS]||These variables are established at the start of the outbound call originated by their FS file and are available for that call only.|
|$var_def [MCF]||These variables are set by the system to record the variables in effect at the time of processing a received fax. These values either originate in the user profile controlling the call or may be established in a post-receive process of type infobox. When assigning a variable in the USR which is to be replicated in the MCF, you would usually use a double @ sign as shown in the examples.|
The $set_var command can only be used in an Infobox file (IIF) although a small subset of its features can also be used in 'conditional text'. The IIF can also be used to copy variables into a generated FS file.
|$set_var [IIF]||These variables are set or created in infobox logic. They survive only until the end of the call. A value assigned to a variable with the same name as one defined earlier in a $var_def overrides the defined value for the duration of the current call only. Assignments to some special variable names have side-effects other than changing the value of the variable: for example an assignment of a filename to the 'variable' named DeleteThisFile actually causes the named file to be deleted.|
|$var_def_copy [IIF]||This command copies current variables, or post_receive and post_process outcome sets of variables, into an FS file created from an infobox.|
To set the value of a variable, you use its name on the appropriate command. For example:
$var_def myname "Steve Hersee"
$set_var count +1 ; increment value of count variable
We recommend using only the letters A..Z and digits 0..9 in variable names, though other characters are valid. Variable names are not case-sensitive. To prevent confusion with system-defined names, avoid using a variable name which starts with the same letters as a variable name in Appendix D. In general, you should use the following guidelines when selecting variable names:
•The underscore character is not recommended because Copia will always try to include an underscore in any new system variables we introduce. So not using this character reduces the chance of a name duplication at some future time.
•The characters @ and ` (or the override characters specified on $macro_char) must not be used because they introduce variable names to be expanded.
•The default or override word terminator characters should not be used, because if a variable to be expanded is not defined anywhere, its name has to be removed from the string being expanded. An embedded terminator character in the name will cause this removal of the name to be incomplete.
•A space or tab character in a variable name will require it to be double-quoted when defined or assigned (but not when expanded). These are also word terminator characters.
•Characters other than those available in system default encoding should be avoided, unless you use $unicode to change the default encoding of the file types (CFG, USR, FS, IIF) involved.
$var_def MyNewVar27 123 ; OK
$var_def BAUDRATE 14400 ; not recommended, conflicts with BAUD
$var_def BD_RATE 14400 ; not recommended, possible future conflict
$set_bar BD@RATE 14400 ; not recommended, will cause confusion
$var_def BD-RATE 14400 ; not recommended, '-' is a word terminator
$set_var "my name" Steve ; not recommended, space is a word terminator
$set_var ウェブサイト @BCF3 ; requires $unicode