UPDATE TABLE SalesPerson From Table Vendor

Hello All,

I am glad to be here with you , am new in AL Developpement ,
looking to achieve some thing very simple i think for you developpers but its seems like its so difficult for mer :’(
I would like some help from you .

so this is my issue.
From Table Vendor i have new field name Registration Code

In table SalesPersonee i have same field Matricule.

i want to create one report wich can update in table SalesPerson the field Registration Code if Code SalesPerson = Code Vendor.

With Sql it will be like that

Update Table A

Set Registration Code =X 


( SELECT Code , Registration Code X from Table B ) AS A

WHERE A.code = B.Code

its so easy with SQL

but difficult for me in AL

Please thank you for your help [emoticon:2e0881b394ea47039c4b7e5eed46a79e]

this is my code in AL

        dataitem("Salesperson/Purchaser"; "Salesperson/Purchaser")
            trigger OnAfterGetRecord()
                vVendor: Record Vendor;
                vVendor.SetRange("No." , "Salesperson/Purchaser"."TM Registration Code");
                if Copystr(vVendor."No.", 6, 8) = Copystr("Salesperson/Purchaser".Code, 6, 8) then begin
                    "Salesperson/Purchaser"."Registration Code" := vVendor."External Customer Code";