[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-------------------+######################################################
#+-| RESTORE_WORK_AREA |------------------------------+#######################
#| +-------------------+ Restores the last work area |#######################
#| saved using save_work_area() |#######################
#+----------------------------------------------------+#######################
##############################################################################
##############################################################################
#+--| Summary |------------------+############################################
#| #INCLUDE database.hdr |############################################
#+-------------------------------+############################################
##############################################################################
##############################################################################
#+--| Syntax |-----------------------------------+############################
#| PROCEDURE restore_work_area PROTOTYPE |############################
#+-----------------------------------------------+############################
##############################################################################
##############################################################################
#########+---| Description |----------------------------------------+#########
#########| The restore_work_area procedure restores the last work |#########
#########| area saved using save_work_area(). The database at the |#########
#########| time of the last save_work_area() is the selected |#########
#########| database. The record pointer of the selected database |#########
#########| is neither saved nor restored with the work area. |#########
#########| -------------------------------------------------------- |#########
#########| The save_work_area() and restore_work_area procedures |#########
#########| function as a stack. That is, the first work area saved |#########
#########| is the last work area restored. Up to 20 work areas |#########
#########| can be saved at one time. |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+---| Design |---------------------------------------------+#########
#########| Use save_work_area() and restore_work_area to write |#########
#########| generic routines without having to worry about the |#########
#########| current selected database. |#########
#########| -------------------------------------------------------- |#########
#########| Suppose there are two different procedures, procA and |#########
#########| procB, to call a single procedure procC. However, given |#########
#########| the manner in which procA is encoded, it expects the |#########
#########| current work area to be #2 while procB expects work area |#########
#########| #3. Therefore, whenever procC is entered, the current |#########
#########| selected work area could be either #2 or #3. Now, if |#########
#########| procC requires the work area to be #1, then it can use |#########
#########| the save_work_area() function to save the current work |#########
#########| area. |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Restore the work area. |#########
#########| |#########
#########| SELECT file_one |#########
#########| DO save_work_area |#########
#########| SELECT file_two |#########
#########| DO restore_work_area |#########
#########| ? "FILE ONE is the current database" |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * When designing a database routine that could be |#########
#########| * called at any time without having to manage the |#########
#########| * select area, use the !<alias> override. This is |#########
#########| * expecially useful if the function is to be |#########
#########| * included in a library file and used for many |#########
#########| * applications. |#########
#########| |#########
#########| FUNCTION CHAR find_name |#########
#########| save_work_area() && to be safe, allows |#########
#########| && proc/function to call. |#########
#########| |#########
#########| !mwa SEEK && seek specific database. |#########
#########| {...} |#########
#########| restore_work_area() |#########
#########| RETURN "result" |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
save_work_area
SELECT
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson