Transferfields Versus Assignment Method (Rec1:=Rec2)

Transferfields Versus Assignment Method (Rec1:=Rec2)
1. What is the main Difference?
2. What is Best Practice and Why?
3. I have a code that causes an error which might be from assignment method, it goes something LIKE this:
Function()
Rec1:=Rec2;
Rec1.Insert(True);
---
function Rec1 - Insert()
Main_Key:= LastNumber + 1;
----
And I get an error: Main_Key (Number) already exists
Can you explain if this happens as a result from assignment method Or should I check my code for other issues?



Best Answer

Answers

  • RockWithNAVRockWithNAV Member Posts: 1,139
    Check out this link it will give an overview.

    dynamicsuser.net/nav/f/106/t/8364
  • vaprogvaprog Member Posts: 1,144
    Hi,

    LastNumber is a global variable in the table object?

    LastNumber is not the same in Rec1, as it is in Rec2, regardless the method you use to populate the fields. (I'm not absolutely sure about this, when it comes to the COPY method, but I am pretty confident.)
Sign In or Register to comment.