Data Insertion in table | DML Operation | X++ Language

Rumman Ansari   Software Engineer   2023-05-26   7880 Share
☰ Table of Contents

Table of Content:


scenario

We have a table EmployeeTable. This table is look like below.

EmpId EmpName DeptId
E001 Rumman Ansari D001

Task 1: You have to insert a row inside the table.

Task 2: Copy all the DeptId from the Dept Table to Employee Table

In this job will insert a row in the EmployeeTable

Below code is solution for the task 1.



static void DataInsertionJob(Args _args)
{ 
        EmployeeTable empdet;
        empdet.EmpId = "E002";
        empdet.EmpName = "Osman Ali Sk";
        empdet.DeptId = "D001";
        empdet.insert();
        info("Data Inserted");
}


Below code is solution for the task 2.



static void DataInsertionJob(Args _args)
{ 
       EmployeeTable empdet;
       DepartmentMy dept; 

        insert_recordset empdet (DeptId)
            select DeptId from dept;
        
       info("Data Copied");

      }
}