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 :
Microsoft Dynamics AX (Archived)

x++ while select "next" record

(0) ShareShare
ReportReport
Posted on by

Hi all,

Have some pseudo code:

SalesTable s;

SalesLine sl;

;

while select s where s.someconditions...

{

//do some stuff 1

sl = SalesLine::find(......);

if(sl.someFunctionThatReturnsAnInt < 300)

{

next s;

}

//do some stuff 2

}

 

-----------------------------

Question.  The keyword "next" simply moves to the next record and continues down to "do some stuff 2?"

What I want is to recognize that my Int function is < 300 and then jump to the next record in the while select statement but I want it to jump to "do some stuff 1" instead of "do some stuff 2."

So basically how do you jump to the next record in SalesTable and continue at the top of the while select statement and bypass "do some stuff 2"

What I believe is happening now is that using "next" fetches the next s record but continues on to "do some stuff 2" which is not my desired results.  I want to not continue on and start my with the next record at the top of the while select ("do some stuff 1")

Any ideas?

Thanks in advance!

----------

Edit:  It seems like the "next" call isn't moving to the next record in SalesTable at all...  Just pointing this out.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Joris dG Profile Picture
    17,780 on at

    in a while select the keyword "next" has no meaning. you either do:

     

    while select salesTable

    {

        do something;

     

        if (you need to skip)

            continue;

     

        do something else;

    }

     

    you use next like this:

     

    select salesTable;

    while(salesTable.RecId != 0)

    {

        do something;

     

        if (you need to skip)

        {

            next salesTable;

            continue;

        }

     

        do something else;

     

        next salesTable;

    }

  • Community Member Profile Picture
    on at

    Thank you Joris.  Continue is the keyword I was looking for.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans