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 NAV (Archived)

REPEAT UNTIL

(0) ShareShare
ReportReport
Posted on by

When this code is ran, I've set up conditions where the repeat loop should fire twice in Navision however it is only executing it once, and not looping a second time.. any ideas why?

There are several components in the table which would be included in the findset, and 2 records in the WhseWorksheetLine which woul be included in the Find set.


recInvSetup.GET;
recCompanyInfo.GET;
recProdOrderComponents.RESET;
recProdOrderComponents.SETRANGE("Prod. Order No.", "Production Order No.");
recProdOrderComponents.SETRANGE("Line No.","Prod. Order Line No." );
recProdOrderComponents.SETRANGE("Routing Link Code", "Prod Routing Line"."Routing Link Code");
IF recProdOrderComponents.FINDSET THEN REPEAT
// Find the Components
recWhseWrkSheetLine.RESET;
recWhseWrkSheetLine.SETRANGE("Worksheet Template Name", recInvSetup."Shortage Batch Name");
recWhseWrkSheetLine.SETRANGE(Name, 'SHORTAGE');
recWhseWrkSheetLine.SETRANGE("Production Order No.", recProdOrderComponents."Prod. Order No.");
recWhseWrkSheetLine.SETRANGE("Item No.", recProdOrderComponents."Item No.");
recWhseWrkSheetLine.SETRANGE("Location Code", recCompanyInfo."Location Code");
IF recWhseWrkSheetLine.FINDSET THEN REPEAT
cuWarehouseManagement.WarehouseWorksheetMovement(recWhseWrkSheetLine, 'SHORTAGE', 'PROCESSING');
UNTIL recWhseWrkSheetLine.NEXT = 0;
UNTIL recProdOrderComponents.NEXT = 0;

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mohana Yadav Profile Picture
    61,214 Super User 2026 Season 1 on at

    what do you have in WarehouseWorksheetMovement function?

    are you modifying record recWhseWrkSheetLine?

    is it passed by reference?

    did you check activating debugger?

  • Suggested answer
    Binesh Profile Picture
    7,887 on at

    Debug and check, weather you are getting records or not, with each value.

  • Community Member Profile Picture
    on at

    REPEAT UNTIL loop will loop through all filtered records. Check if your filters are correct.

    You can use COUNT keyword to know the no. of records filtered.

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans