LOOP (query handler)
Syntax
![]()
Command
Mandatory parameter Optional parameter Mandatory keyword Optional keyword |
LOOP <Query handler>
<Code lines>
ENDLOOP
Description
Does an implicit SQL query execute and then loops through the result set. Repeats execution of the enclosed code lines for each record. This means the first record of the result set will be fetched before the loop is executed the first time and then the next record before the each next loop. The loop will end when the last record of the result set has been fetched and the loop code has been executed.
Diagram
Returned value type
None
Parameters
Parameter | Description |
<Query handler> |
The name of the Table Query, Query or Stored Procedure handler to execute |
<Code lines> |
Code that is performed each time the loop is executed. The loop will be terminated in one of the
following cases:
|
Example
q_ccdemdet.index (proccdemdet)
q_ccdemdet.equal (lijndcode)
q_ccdemdet.start (reisnr, '')
q_ccdemdet.where (q_ccdemdet.openstaand = True)
loop q_ccdemdet
if reisnr <> '' and reisnr <> q_ccdemdet.reisnr then bk
add_container ()
endloop
q_ccdemdet.equal (lijndcode)
q_ccdemdet.start (reisnr, '')
q_ccdemdet.where (q_ccdemdet.openstaand = True)
loop q_ccdemdet
if reisnr <> '' and reisnr <> q_ccdemdet.reisnr then bk
add_container ()
endloop