21. 4GL Statement Glossary : Next
 
Share this page                  
Next
Displays the next row of retrieved data on the form.
Syntax
next
The next statement has no parameters.
Description
The 4GL next statement is useful when a database retrieval returns more than one row of values into a form that can hold only a single row at a time, as in an attached query with a submenu or query loop. By activating a menu operation that includes the next statement, a user can display the subsequent rows of data. When the retrieval occurs in the parameter list while calling another frame, the next statement normally appears as part of a menu operation in the called frame. If the retrieval occurs within a frame, the next statement appears in a submenu.
The next statement causes subsequent rows of data to be displayed until no more rows are found. After all rows have been displayed, executing the next statement leads to this message:
No more rows
The main menu, if it is also the current menu, is then redisplayed. If the current menu is a submenu, the main menu for the frame appears, and control passes to the statement immediately following the original assignment statement that contained the submenu. For more information on submenus, see Submenus.
In a query on a Master/Detail join, using the next statement causes the next master row to be displayed along with all its associated detail rows. For more information about Master/Detail queries, see Master/Detail Query.
Example
Select employee information one row at a time into the simple fields of Empform. This is an example of an attached query with a submenu.
empform := select lname, fname, empnum 
  from employee 
  where empnum <= 100 
  begin
  /* submenu statements here including: */
    'NextRow' = 
    begin 
      next; 
    end 
  end;