Importing one line into 2 tables

Hi All, I have a situation where i want to import a record into two tables, let explain with example. ex: I have to import attendance record of an employee, format of the attendance is → “Employee No.”,Attended Date,Time-In,Time-Out like E0001,010905,0900,1400 Now there are 2 tables, Time Sheet Main & Time Sheet Sub. so i want to import 1. Employee No. & Attend Date into Time Sheet Main Table 2. ANd the whole record into Time Sheet Sub Table. Please suggest!! Thanks in advance, vikas

Hi Vikas, Since you have all the information in your sub Table you can create your Main Table Everytime the Employee No. & Attend Date changes. I assume Employee No. & Attend Date is the Link between the two tables. If you’re importing with a Dataport absed on SubTable you can do something like this in the OnAfterImport. … IF (MainRec.“No.” <> SubRec.“No.”) AND (MainRec.Date <> Rec.Date THEN BEGIN MainRec.INIT; MainRec.“No.” := SubRec.“No.”; MainRec.Date := Rec.Date ; IF MainRec.INSERT THEN; END; … Depending on your Rules and Errorhandling you will have to add more code. Regardless of how you import a general Rule of thumb is that you should create your Header Record before SubRecs even when its the SubRecords that seems to be the datadrivers in your case. Jens