Chapter 1: X++ Unit Test Framework
Chapter 2: Working with Data
Chapter 3: Classes
Chapter 4: Forms
Chapter 5: Visual Studio Integration
Chapter 6: Workflow
Lesson 1 : While Select
While Select statement this section describes the different qualifiers and options that can be used in the this statement, to achieve optimal database access performance.
This statements are used to handle data. They are the most widely used form of the axselect statement in X++.
This loops over many records (meeting certain criteria) and can execute a statement on each record.
When you perform data manipulation by using this statement, you would typically do this in a transaction to ensure data integrity.
In a this, the axselect statement itself is executed only one time, immediately before the first iteration of the statements in the loop. Also, any Boolean expressions (such as iCounter < 1) added to the while select are tested only one time. This differs from how the while statement behaves in languages such as C++ and C#. For example, in X++ the following loop could iterate more than one time.
The results of a while select statement are returned in a table buffer variable. If you use a field list in the select statement, only those fields are available in the table variable. If you use aggregate functions such as sum or count, the results are returned in the fields you perform the sum or count over. You can only count, average, or sum the integer and real fields.