How to define and use a table as an object of itself. “If we want to run a table in a loop with original records and another loop within,with the object where we may insert new records or make some changes without affecting the outer loop’s table’s records.”
I think I know what you are asking does this help:- If you call a procedure with the paramater of record type and unVARed then a new instance of the record is used. Which is what you want. If the record type is VARed then it is the same instance of the table. So if you use REPEAT Proc(Record); Until Record.NEXT=0; This loop is not upset what ever you do to the record in your procedure. Paul Baxter
Hi, and if you you don’t want to call a new procedure but directly having the code within the first loop just create a second var, type record of the same table, assign the var of the first loop to the second one (Rec1 := Rec2) and manipulate/insert using Rec2… Saludos Nils
Nils is right but does not make for clean readable code and so should be avoided. In fact as a rule when you have any loop or any time you use Begin/End you should think if that should be in a subroutine. Any more that four or five lines of code and it should be. But then that’s another discussion. Paul Baxter
While I agree with Paul’s points, however even when called as a subroutine you will sometimes need to have to “copies” of a record variable. I have seen numerous examples of Navision code where the record variables names are like Job1/Job2. When I am in this situation, I like to name the variables something a little more meaningfull such as: JobToRead/JobToModify Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117