Pass Record to Function or pass Primary Key and get Record
doddwell
Member Posts: 65
Hello
I have the following objects:
A table called "Retro Discount" and a form called "Retro Discount Card".
A table called "Retro Discount Schedule" and a subform called "Retro Discount Schedule Subfrm".
A code Unit called "Retro Discount Management" with a function called "CreateRetroSchedule"
The user presses a button on the Retro Discount Card which calls the CreateRetroSchedule function to create the Retro Discount Schedule records.
Should I:
1 - pass the "Retro Discount" record to the code unit
OR
2 - just pass the "Retro Discount" Primary Key value and then allow the function to GET the "Retro Discount" record
I know that both ways will work - I'm just wondering which way is the 'NAV' way?
Thanks Very Much. Simon
I have the following objects:
A table called "Retro Discount" and a form called "Retro Discount Card".
A table called "Retro Discount Schedule" and a subform called "Retro Discount Schedule Subfrm".
A code Unit called "Retro Discount Management" with a function called "CreateRetroSchedule"
The user presses a button on the Retro Discount Card which calls the CreateRetroSchedule function to create the Retro Discount Schedule records.
Should I:
1 - pass the "Retro Discount" record to the code unit
OR
2 - just pass the "Retro Discount" Primary Key value and then allow the function to GET the "Retro Discount" record
I know that both ways will work - I'm just wondering which way is the 'NAV' way?
Thanks Very Much. Simon
0
Comments
-
Both are ok. The record pass as a var would save you from creating a key in memory.
More important is, do you expect the record to change in that function? Then save the changes first.0 -
Thanks for your help. I don't expect the record to change after the function is called from the form. However, I suppose there is a small chance it could be changed by another user - so I am thinking that I should pass the Primary key as a variable and then have the function get the record.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions