xRec = Rec; Why

bmccarthybmccarthy Member Posts: 48
I have been looking at contact lookup from the Sales Header and saw
xRec = Rec;

I have copied the code to my table however, I do not understand this line.
Can someone explain why this is here.
Cheer :?


IF ("Sell-to Customer No." <> '') AND Cont.GET("Sell-to Contact No.") THEN
Cont.SETRANGE("Company No.",Cont."Company No.")
ELSE
IF "Sell-to Customer No." <> '' THEN BEGIN
ContBusinessRelation.RESET;
ContBusinessRelation.SETCURRENTKEY("Link to Table","No.");
ContBusinessRelation.SETRANGE("Link to Table",ContBusinessRelation."Link to Table"::Customer);
ContBusinessRelation.SETRANGE("No.","Sell-to Customer No.");
IF ContBusinessRelation.FINDFIRST THEN
Cont.SETRANGE("Company No.",ContBusinessRelation."Contact No.");
END ELSE
Cont.SETFILTER("Company No.",'<>''''');

IF "Sell-to Contact No." <> '' THEN
IF Cont.GET("Sell-to Contact No.") THEN ;
IF FORM.RUNMODAL(0,Cont) = ACTION::LookupOK THEN BEGIN
xRec := Rec;
VALIDATE("Sell-to Contact No.",Cont."No.");
END;[/b]

Comments

  • krikikriki Member, Moderator Posts: 9,110
    Probably in the OnValidate-trigger of "Sell-to Contact No.", there is some code to test if a value has changed to do somthing. With the "xRec := Rec;" the old and new values are the same and that part of the code is avoided.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.