web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • 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

Responsible AI policies

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

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#1
Guy Terry Profile Picture

Guy Terry 2 Moderator

#1
Rahul Shah Profile Picture

Rahul Shah 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans