Switching Off Recursion Checking

RAMP-NL

Switching Off Recursion Checking


Each time a RAMP script is executed, the Framework checks if the script has been called recursively and flags an error if it has.

However, situations may arise where a script may appear to be called recursively, for example if a special screen appears two or more times in succession. In these cases the GLOBAL_flagRecursionCheck property can be used to switch off the recursion checking and avoid applications ending in error.

The property can be used in scripts in this way:

   

var flagSaveCheckState = GLOBAL_flagRecursionCheck;

 

GLOBAL_flagRecursionCheck = false;

 

SENDKEY(KeyEnter);

 

GLOBAL_flagRecursionCheck  = flagSaveCheckState;

  

Saving and restoring the state like this, rather than simply setting the global property to TRUE or FALSE is the best solution because this is a recursive situation. The Framework will handle three or four levels of recursion (depending on script size and system resources available) if a special screen appears this many times. Only the top recursion level will finally set the GLOBAL_flagRecursionCheck property back to TRUE again.