Coding Best Practices - Custom Lookups

Mike_HWG
Member Posts: 104
I have a situation where I'm building a table called Market Update Subscription. I want one of the fields to look up to another table. However, the filter on the lookup table is complex: I want the "Cust. Mkt. Update File Formats" table filtered by either blank values or the Customer No.
At the moment, I have the following code in my Market Update Subscription table:
The reason I added it to the table is that I want this to be the standard behavior for this field. However, I've usually seen lookups of this structure added to the form....
Is it better practice to have this code in a form instead?
At the moment, I have the following code in my Market Update Subscription table:
File Format - OnLookup() WITH MarketUpdateFileFormat DO BEGIN RESET; FILTERGROUP(100); SETFILTER("Customer No.",'''''|%1',REC."Customer No."); FILTERGROUP(0); IF FORM.RUNMODAL(FORM::"Cust. Mkt. Update File Formats",MarketUpdateFileFormat) = ACTION::LookupOK THEN REC."File Format" := "File Format"; END;
The reason I added it to the table is that I want this to be the standard behavior for this field. However, I've usually seen lookups of this structure added to the form....
Is it better practice to have this code in a form instead?
Michael Hollinger
Systems Analyst
NAV 2009 R2 (6.00.34463)
Systems Analyst
NAV 2009 R2 (6.00.34463)
0
Answers
-
It's always better to have this type of logic in the table, never on the form, for exactly the reason you describe.0
-
Excellent!Michael Hollinger
Systems Analyst
NAV 2009 R2 (6.00.34463)0 -
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