how to transfer a form details to another form?

Jacob1227
Member Posts: 128
how to transfer a form details to another form even one field has different data type in each tables?
0
Answers
-
tableA.Field1 := tableB.Field1;
tableA.Field2 := tableB.Field2;
...and so on.
Skip fields which do not match.
Wrap the code in a function so you can reuse it. Even if you don't plan to re-use it still wrap it in a separate function - it will make your code more readable,Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-032 -
thanks for this.Can u please elaborate the coding ? and Which trigger i have to put this code?0
-
There is not much philosophy or science there. It is just a series of assigment statements wrapped in a function, nothing more.
When you call ToRecord.TRANSFERFIELDS(FromRecord) the system copies fields from FromRecord to ToRecord. The idea is to build a function doing the almost the same but skipping unwanted fields. Since the TRANSFERFIELDS is called on a destination record (ToRecord.REANSFERFIELDS...) then to make my custom copy fields function similar I am also defining it on source table.
I am also trying to stick to specific naming convention, and call my function CopyFromSomeRec() so furtehr down the code I can clearly see what it is doing
ToRecord.CopyFromRecordA(RecordA)
If the function is suposed to copy fields from some record A to record B, then on table B (destination table) I would create function CopyFromRecordA, with RecordA as a parameter, and inside this function put a series of assignments.
Just note that both TRANSFERFIELDS and a function assigning field values is not supposed to insert anyting into the database. Both are supposed to do in-memory copy - that's it. If you want to make a copy of record A into record B in the database you need to insert that copy into the DBRecB.CopyFromRecordA(RecA); RecB.INSERT;
Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-031
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K 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
- 320 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