Primary key question
Prontiol
Member Posts: 10
I have a primary key, which consists of 6 fields, but it looks like sixth field is not required to do GET(). I mean, when I do record.GET(f1,f2,f3,f4,f5) it returns the first appropriate line (for these five keyfields), disregarding value of the f6 field, though it is included in the primary key.
When I use GET() with 6 keyfields i can get the required line without any problems, but why it does not give me an error, when I use only 5 fields when the key requires 6?
This is not the only problem, 'cause dataports for this table also do their work using only 5 first keys, giving me the whole data messed up in the result.
I use Navision 3.7 on MSSQL 2000.
Any thoughts?
When I use GET() with 6 keyfields i can get the required line without any problems, but why it does not give me an error, when I use only 5 fields when the key requires 6?
This is not the only problem, 'cause dataports for this table also do their work using only 5 first keys, giving me the whole data messed up in the result.
I use Navision 3.7 on MSSQL 2000.
Any thoughts?
0
Comments
-
It is possible to do a GET on fewer fields than are included in the primary key. I agree that there should be a design time warning when you do this, but that is how it works.
Obviously if you have a value for only 5 out of 6 primary key fields, you cannot guarantee the uniqueness of the record.0 -
If you do a GET on the first 4 (out of 5) fields, the system will try to retrieve the record with the last field blank (or default value). If the record exists, everything is fine. If it doesn't then an error will arise. On any table try a GET statement with no values. The system will just try to retrieve a record with blank primary key values.0
Categories
- All Categories
- 73 General
- 73 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 333 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 991 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
