Was this helpful?
Target Scrolls
The following example contains three activate sections, each of which demonstrates a different use of the target scroll:
     /* assume previous declarations, plus ... */
## searchname  character_string(20)
## activate menuitem "bottom"
## {
     /* scroll to end of data set */
##   scroll empform employee to end
## }
## activate menuitem "top"
## {
     /* scroll to first record in data set */
##   scroll empform employee to 1
## }
## activate menuitem "find"
## {
     /* prompt for name to search for */
##   prompt ("name to search for: ", searchname)
     /* loop through data set and stop  
     ** when name is found.
     */
##   unloadtable empform employee
##        (vname = ename, record = _record)
##   {
        if (vname = searchname) then
            /* scroll to record with specified name. */
##          scroll empform employee to record
##          resume field employee
        end if
##   }
##   message "cannot find named employee."
##   sleep 2
## }
Notice the use of the resume statement in the activate section for menu item find. When the name is found, the activate section is terminated by the resume statement.
Only if all rows are unloaded and the name still has not been found does control pass to the message statement following the end of the unloadtable loop.
Last modified date: 08/14/2024