Skip to main content
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

  • Community Member Profile Picture
    on at
    Re: x++ while select "next" record

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

  • Verified answer
    Joris dG Profile Picture
    17,775 on at
    Re: x++ while select "next" record

    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;

    }

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Kempeth Profile Picture

Kempeth 4

#1
Andy Adamak Profile Picture

Andy Adamak 4

#1
Community Member Profile Picture

Community Member 4

Featured topics

Product updates

Dynamics 365 release plans