Two times repeat

Mbad
Mbad Member Posts: 344
My turn to pose a question.

If you need to run through a recordset using next is there a method to get the first record for the second run through without getting a new version(by find) or running next(-1) through the recordset. Would alose avoid filling a temp if possible.

To clearify what i need to do is basicly:
somerecord.setfilter(somefilter);
somerecord.findset;

repeat
  blah blah;
until somerecord.next = 0;

// here i need to find the first record again

repeat
  blah blah;
until somerecord.next = 0;

Comments

  • Waldo
    Waldo Member Posts: 3,412
    I guess there isn't.

    As NAV works with CURSORS, you want to set the pointer of the cursor back to the beginning. I don't know of a way to force this through C/AL.

    FINDFIRST is a SELECT TOP 1 *, FIND('-') is also a "SELECT" ... not what you need.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • MTC
    MTC Member Posts: 159
    This might sound daft, but couldn't you simply take a copy of rec into another variable after the first find?
  • Mbad
    Mbad Member Posts: 344
    MTC wrote:
    This might sound daft, but couldn't you simply take a copy of rec into another variable after the first find?

    Thats what i meant by not wanting to use temps.

    But nevermind. Ill redesign it.