Assign/save xrec to a variable

I am learning AL/Business Central and was wondering if it is possible to save the value of xrec or rec into a variable when the field is modified?

For example this thorws me an error:

field(4; “field1”; Integer)
{
DataClassification = CustomerContent;
Caption = ‘Field1t’;
trigger OnValidate()
var
beforeMod: Integer;
beforeMod: xrec.“No. on Playlist”;

begin

end;

ERROR: ‘xrec’ is not recognized as a valid type.

I still did not understand how to assign values to a variable. And i am not sure if it is right to put this on the onValidate trigger of the field. ( I want to check if the new entry is higher or lower than the entry before)

Thangs in advance

Ok i found the error by myself.

I have to assign the value within the trigger´s “begin” and “end”

field(4; “field1”; Integer)
{
DataClassification = CustomerContent;
Caption = ‘Field1t’;
trigger OnValidate()
var
beforeMod: Integer;

begin

beforeMod:= xrec.“No. on Playlist”;

end;

Yes, in BC you cannot assign initial values as part of your variable creation.