Quantcast
Viewing all articles
Browse latest Browse all 10032

Why does my loop end after 1 iteration?

SubJobsT.SETFILTER(SubJobsT."Master Job No.", JobsT."No.");
    IF SubJobsT.FINDSET THEN BEGIN
      REPEAT
        IF SubJobsT."Job Type" = Job."Job Type"::Resource THEN BEGIN
          // do stuff
        END ELSE BEGIN
          count := count + 1;
          NewJobNo := JobNoFormat(ResourceJobNo, count);
          NewJobNo := JobNoValidation(SubJobsT, NewJobNo);
          SubJobsT.LOCKTABLE;
          SubJobsT."Parent Job No." := parentJobNo;
          SubJobsT.MODIFY;
          SubJobsT.RENAME(NewJobNo);
       END;
      UNTIL SubJobsT.NEXT = 0;
    END;
    count := 0;

Here is a sample of the code, i cut things out that were not important.
However, I am trying to run this on a big set of jobs, and each master job has set of child jobs.
I have a group of jobs (96) that are all items (not resources) that run through this loop only one time.
It only does the first item of the list and then ends the loop.

Any suggestions?

Viewing all articles
Browse latest Browse all 10032

Trending Articles