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

Notifications

Announcements

No record found.

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
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans