How to: |
The ON NEXT command defines the action to take if the prior NEXT command succeeds (if it is able to retrieve all of the specified records). There can be intervening commands between the NEXT and ON NEXT commands, and they can be in separate functions.
It is recommended that you query the FocFetch system variable in place of issuing the ON NEXT command. FocFetch accomplishes the same thing more efficiently. For more information, see FocFetch.
The syntax of the ON NEXT command is
ON NEXT command
where:
Is the action that is taken when NEXT is successful.
You can specify any Maintain Data command except for CASE, DECLARE, DESCRIBE, END, MAINTAIN, MODULE, and another ON command.
The first example displays a message stating that the NEXT was successful:
NEXT Emp_ID; ON NEXT TYPE "Was able to NEXT another employee";
This example computes a five percent increase for the next employee in the data source:
NEXT Emp_ID; ON NEXT COMPUTE NewSal/D12.2 = Curr_Sal * 1.05;
The following example shows several commands that are executed after a NEXT:
ON NEXT BEGIN TYPE "Was able to NEXT another employee"; COMPUTE NewSal/D12.2 = Curr_Sal * 1.05; ENDBEGIN