Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Business Central forum

How to loop over each record in a set?

(0) ShareShare
ReportReport
Posted on by 450

So i put a range on a page so i only get the records of a specific customer.

So in code i did:

myTable.SetRange(CustomerNo, CustNumb);
myTable.FindSet();

Now I need to loop over these results but it seems that's not possible to loop over it now with a foreach item in myTable.

In what way am i able to do this?

Categories:
  • Suggested answer
    InsertX Profile Picture
    450 on at
    RE: How to loop over each record in a set?

    Found it myself using:

    REPEAT

    ...

    UNTIL myTable.Next() = 0;

  • Verified answer
    Community Member Profile Picture
    on at
    RE: How to loop over each record in a set?

    You have to write code as below:

    myTable.SetRange(CustomerNo, CustNumb);

    if myTable.FindSet() then repeat

     //It will loop until last record

    Until myTable.next = 0;

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans