ContRecRef.OPEN(5050); ContRecRef.SETVIEW('WHERE(Salesperson Code = CONST(JR))'); ContRecRefTemp.OPEN(5050,TRUE); MESSAGE(FORMAT(ContRecRefTemp.COUNT)); // Returns '0' - ok ContRecRefTemp := ContRecRef.DUPLICATE; MESSAGE(FORMAT(ContRecRefTemp.COUNT)); // Returns '120' - ok IF ContRecRefTemp.FINDSET(TRUE) THEN REPEAT FldRef := ContRecRefTemp.FIELD(10); //Telex No. FldRef.VALUE := 'BlaBlaBla'; ContRecRefTemp.MODIFY; UNTIL ContRecRefTemp.NEXT = 0; IF ContRecRef.FINDFIRST THEN BEGIN FldRef := ContRecRef.FIELD(10); MESSAGE(FORMAT(FldRef.VALUE)); // Returns 'BlaBlaBla' - not ok END;
DUPLICATE (RecordRef)
Comments
The recordref that is returned refers to a table with the exact same values, filters, current keys and marks as the original table. However, any changes that you make to the duplicate will not be reflected in the original. (This is different than assigning one recordref to another recordref, where they continue to refer to the same table and where changes made to one are reflected in the other.)
Comments
Because if you do only assignment without DUPLICATE, and if you change some data in the record, both recref will have the data changed. The RecRef are still "pointing" to same record in memory. But if you do DUPLICATE, the object in memory is duplicated and the recref points to another area of memory...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.