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)

Is There a Method That Lets Me Know IF There Is a Next Loop in a While Select Loop? Something like hasNext()?

(0) ShareShare
ReportReport
Posted on by 1,042

Hello awesome community! I'm new to AX and its development and I seek your help if you please :)

I have a while select loop, is there a method that lets me know there is a next loop?

Something like if(selectLoop.hasNext())?

because I want to add a "-" in a string with each loop, in each loop i'm adding a new string in a big string variable. But the words appear next to each other without a space or a dash separating them, so I want to know if there is another step in the while select loop to add "-" to the big string between each loop.

Thanks!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    I don't think there is a hasNext when you iterate a table buffer. But I don't think you need that.
    Here's an example:

    boolean firstIteration = true;
    MyTable myTable;
    str myStr;
    
    while select myTable
    {
        if (!firstIteration)
        {
            myStr += "-";
        }
        else
        {
            firstIteration = false;
        }
    
        myStr += myTable.myField;
    }


    The result will be a string with values from myTable.myFieldId, separated by "-".

  • Momochi Profile Picture
    1,042 on at

    oh it was that simple....haha

    Thanks for your time and help!

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

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans