Options

Add a primary key to a table

ntnt Member Posts: 160
hi,

I got to add a primary key to a table, i'm wondering what are the implications of that.
I got to modify the get function that use this table?

Any more ideas?

Thanks.

Comments

  • Options
    dick11dick11 Member Posts: 60
    You cannot add a primary key!

    You can change it, and if you change it you must change your Gets. Gets are always using the primary key.

    You could also add a secondary key and access it for example via Setcurrentkey, SetFilter and then a Find.

    Success
    Dick van der Sar

    www.dasautomatisering.nl
  • Options
    DenSterDenSter Member Posts: 8,304
    The primary key of a table is meant to uniquely identify a record. In any database management system, there can only be one primary key.

    What Navision is missing though is a setting to enforce a secondary key to only store unique values, although I've only seen one instance in which this is useful. So if you want to keep certain combinations of field values unique, you will have to program something yourself.

    The GET method can only reliably be used on primary keys. using any other key I would set filters on the fields and do a FIND('-'), and using the return value of the FIND method, combined with COUNT to determine whether a value combination is unique.
Sign In or Register to comment.