Primary key question

Prontiol
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?

Comments

  • DenSter
    DenSter Member Posts: 8,307
    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.
  • wonmo
    wonmo Member Posts: 139
    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.