web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

While select statement

(0) ShareShare
ReportReport
Posted on by 152

can anyone please explain how to use while select statement in ax.

I have gone through docs but I am unable to understand it. Could anyone please explain this with a example.

Thanks,

Nithin.

I have the same question (0)
  • Verified answer
    Satish Panwar Profile Picture
    14,671 Moderator on at

    Hi Nothing,

    Not sure if you looked at link below, it has good explanation.

    https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-data-query#while-select-statements

    In short it's a way to loop through records and perform either any calculation or comparison etc. If something is not clear add more details please.

  • Verified answer
    Blue Wang Profile Picture
    Microsoft Employee on at

    Hi Nithinkumar,

    The syntax of a while select statement resembles that of a select statement except that it is preceded by while select instead of select.

    Use a while select statement to loop over a set of records that meet some criteria and perform an action on each record.

    When you perform data manipulation by using the while select statement, you would typically do this in a transaction  to ensure data integrity.

    For Example follow code, This prints number within a specified range in myTable.

    MyTable  myTable;
    while select myTable 
           where  myTable.Num >= "1" && myTable.Num <= "10"
    {
        info(strFmt("%1", myTable.Num));
    }

    https://docs.microsoft.com/en-us/dynamicsax-2012/developer/while-select-statements

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 663

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 439 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 337 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans