web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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,005 Super User 2025 Season 2 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,885 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

Responsible AI policies

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

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans