copy of data from one table to another table
                
                    suri                
                
                    Member Posts: 123                
            
                        
            
                    hi good evening one and all
i have created two tables
table 1 and table 2
table 1 consists of fields
no name designation
1 bbb kkkk
2 nnn mmm
3 kkk llllll
table 2 consists of fields
no name designation
i want to copy data from table 1 to table 2
i have written code like this as shown below
table1.RESET;
IF table1.FINDFIRST THEN
REPEAT
INIT;
no :=table1.no;
name :=table1.name;
designation :=table.designatio;
INSERT;
UNTIL table1.NEXT=0;
but it was not inserting any values into the table2
can any one can give suggetsion
thank you
                i have created two tables
table 1 and table 2
table 1 consists of fields
no name designation
1 bbb kkkk
2 nnn mmm
3 kkk llllll
table 2 consists of fields
no name designation
i want to copy data from table 1 to table 2
i have written code like this as shown below
table1.RESET;
IF table1.FINDFIRST THEN
REPEAT
INIT;
no :=table1.no;
name :=table1.name;
designation :=table.designatio;
INSERT;
UNTIL table1.NEXT=0;
but it was not inserting any values into the table2
can any one can give suggetsion
thank you
0                
            Comments
- 
            Manually copy rows in table 1 and paste in table 2.
Where did you write above code?0 - 
            hi mohana thanks for giving reply....i have tried in the below manner.
actually one thing i dont know where to write the code..can you send any pdf file regarding this triggers,,,,when and where to write the code...it will be helpful to me ...thank you
i have tried in on after get record in reports(but the data was not inserted)
i have tried in on validate of no field in table 2(but the data was not inserted)
i have tried in on insert in table 2(but the data was not inserted)0 - 
            Here is the Help link
http://msdn.microsoft.com/en-us/library/dd301068.aspx
You need to take Table1 as dataitem and check whether record is available in table2, if not insert..0 - 
            ya mohana sir
i have tried the below code in
predataitem() with processing only yes
testing.RESET;
IF testing.FINDFIRST THEN REPEAT
test9.INIT;
test9.no :=testing.no;
test9.designation:=testing.designation;
test9.INSERT;
UNTIL testing.NEXT=0;
it was working fine
thanks for your reply
can you share me the pdf file linc..please0 - 
            Why don't you write the copying code in the loop in the 'OnAfterGetRecord()' trigger of the report ?
If you want to copy the table as it is, you can also use the 'TRANSFERFIELDS' function in the 'OnAfterGetRecord()' trigger of the report with the following code :test9.transferfields(test);
Thanks & Best Regards,
Ram.0 - 
            In case you need to add fields from one table to another where the target has a different key, you will need to do something like this:
SalesInvHeader does not have a Document Type but HeaderLog does.
HeaderLog is otherwise identical.
Option 0 = Invoice
SalesInvHeader.GET("No.");
IF NOT HeaderLog.GET(0,SalesInvHeader."No.") THEN BEGIN
HeaderLog.INIT;
HeaderLog."Document Type" := 0;
HeaderLog."No." := SalesInvHeader."No.";
HeaderLog.INSERT;
HeaderLog.TRANSFERFIELDS(SalesInvHeader,FALSE);
HeaderLog.MODIFY;
END;
If you only need a subset of the SalesInvHeader transferred to HeaderLog, remove the unwanted fields in HeaderLog.Experience is what you get when you hoped to get money0 
Categories
- All Categories
 - 73 General
 - 73 Announcements
 - 66.7K Microsoft Dynamics NAV
 - 18.7K NAV Three Tier
 - 38.4K NAV/Navision Classic Client
 - 3.6K Navision Attain
 - 2.4K Navision Financials
 - 116 Navision DOS
 - 851 Navision e-Commerce
 - 1K NAV Tips & Tricks
 - 772 NAV Dutch speaking only
 - 617 NAV Courses, Exams & Certification
 - 2K Microsoft Dynamics-Other
 - 1.5K Dynamics AX
 - 323 Dynamics CRM
 - 111 Dynamics GP
 - 10 Dynamics SL
 - 1.5K Other
 - 990 SQL General
 - 383 SQL Performance
 - 34 SQL Tips & Tricks
 - 35 Design Patterns (General & Best Practices)
 - 1 Architectural Patterns
 - 10 Design Patterns
 - 5 Implementation Patterns
 - 53 3rd Party Products, Services & Events
 - 1.6K General
 - 1.1K General Chat
 - 1.6K Website
 - 83 Testing
 - 1.2K Download section
 - 23 How Tos section
 - 252 Feedback
 - 12 NAV TechDays 2013 Sessions
 - 13 NAV TechDays 2012 Sessions
 

