Set Next Infobox or State to Transfer to

$next_box infobox|Sstatenum|S:state|@varname

This command is used to control the progress of a transaction. After processing the current infobox, often a $type question infobox or a $type decision infobox, the parameter from this command is used to specify the next action, which may involve transfer either to an infobox or to a new processing state.

The parameter on this command is used as follows:

infobox the name or number of an infobox (names should not start with an 'S' and numeric digits, which would be interpreted as a state).
statenum the number of a suitable state as shown in Appendix C: State Table. Use this option with caution.
state the name of a suitable state as shown in Appendix B: State Table. Use this option with caution.
varname the name of a variable whose contents contain an infobox name or number.

When the $next_box command is given in a $type menu IIF, it specifies the processing when the "zero" menu option is selected. The $next_box command is ignored if the caller selects an option other than zero. This command replaces the obsolete $menu_exit command which can only select a state.

When your infobox terminates an infobox sequence reached from a trapped state such as LINK_INIT or LINK_FINISH, or where several states are visited during the processing of a single infobox sequence, you should use the letter 'R' instead of 'S' in front of the state name or number, which should normally be that of the state which you trapped.  This will restore the necessary context of the original infobox which was in control of the call at the time the most recent $set_state command was reached.  The same applies to the use of the TRAP_LINK_FINISH variable.

Default: during fax-on-demand, return to state 6 (play standard voice prompt 4, more images prompt) if not specified. Otherwise, this command or $chain is a required command to define the continuation of processing in a sequence of infoboxes.

Examples:

$next_box 123 ; go to box 123

$next_box @val ; go to the box contained in variable VAL

$next_box s157 ; say good_bye and hang up

$next_box s:good_bye ; say good_bye and hang up

If you have a programming background, it is tempting to assume that $next_box is equivalent to GOTO. It is not. In the following example, infobox 1 will never be selected, because the current infobox is processed in its entirety before the next box is selected, and the second command will always override the first:

$if @response = 1 ; ! incorrect example

  $next_box 1     ; ineffective

$endif

$next_box 9       ; always selected

The correct way to code the above example is:

$if @response = 1

  $next_box 1

$else

  $next_box 9

$endif