KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Different ways to loop through a selection of records
PRODUCT: 4D | VERSION: 2003.1 | PLATFORM: Mac & Win
Published On: October 23, 2003
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Versions: 6.7.x, 6.8.x, 2003.x
Platforms: Mac OS and Windows

There are three types of loop statement that can be used in 4D. Each statement can be used to loop through a selection of records. Here is how For...End for, Repeat...Until and While...End while statements can be used to loop through a selection of records:

USING For...End for statement:
For ($i;1;Records in selection([Table 1]))

` Do something here

NEXT RECORD([Table 1])
End for


USING Repeat...Until statement:
Repeat

` Do something here

NEXT RECORD([Table 1])
Until (End selection([Table 1]))


USING While...End while statement:
While (Not(End selection([Table 1])))

` Do something here

NEXT RECORD([Table 1])
End while