Conditional Processing Examples
CopiaFacts supports conditional processing of most command files, but their principal use is in infobox (.IIF) files. Conditional commands are most useful in connection with $type decision infoboxes which are used to analyze responses to IVR prompt messages, but have many other applications also.
Other advanced uses of conditional processing are described in the CopiaFacts Scripting entry in the Features section.
Note that the conditionals in .FS files are processed when the file is first read by CopiaFacts; the .FS files written back into the SENT, FAIL and (for retries) TOSEND directories will reflect the conditional processing which occurred on first reading of the file.
All values and filenames on these commands are subject to variable-expansion using the normal @ syntax. Examples:
$if 06/2013 $in @date4
$ifn @myvar1 = @myvar2
$if @class > 100
$ifn X $in @class
$image_password dist.ndx 2
Parameters for comparison must not be surrounded by double-quotes; the double-quotes are not stripped before the comparison is done. To test for a constant value with embedded spaces, assign it first to a variable:
$set_var testname "My Name"
$if @namevar = @testname
Conditional commands may be nested up to 32 levels deep. The proper terminating $endif commands must always be supplied. For example:
$if @myvar1 = foo
$if @myvar2 = bar
Testing variables set from DTMF
|IMPORTANT: Any variable set by a $get_var command will not have its value available for testing in the same .IIF file. This is because the user interaction to set the variable does not occur until after the first infobox has been completely processed. To test a value which has been input by the caller, use $next_box to transfer control to a new $type decision infobox, in which you can use the appropriate $if statements. For example:|
$get_var varname2 3 5
$if @EXPERT = Y
$if @varname1 = @varname2
There is one more potential problem with constructing conditional statements in .IIF files: if you have ever done any computer programming, you may be tempted to treat $next_box like a "go to", which it is not. The following example illustrates this error:
;infobox 777 *** incorrect example ***
$if @value = 23
$next_box 4567 ; this line must be in an $else group
In the above example, when the value is 23 control does not immediately transfer to box 2300. Instead the 2300 gets overridden by the 4567 when the second $next_box command is processed. The correct way to construct this type of .IIF file is shown in the example infobox 9000 above.
Configuration File Variables
Inside the configuration file, the most common variable use is for isolating version-specific commands, and selecting nodes. For example:
$if @FFVERSION > 820000
$voip ... ... ...
$if @NODEID = M1
$var_def M1VAR VALUE
$if EMAIL $in @NODEID
It is important to remember that @NODEID is only defined in the COPIAFACTS engine, and that these conditionals are anyway ignored in FAXFACTS.CFG by other programs. Also, many commands in FAXFACTS.CFG are required to be globally defined. Use conditionals in this file with great care.