Condividi tramite


20 Key Limitation across Primary Key, Secondary Key and SumIndexFields

The NAV documentation clearly indicates that a primary key is limited to 20 fields and that the number of fields in the primary key together with all the fields in secondary key must not exceed 20. Furthermore, it states that a SumIndexField can have at most 20 SumIndexFields. In fact the limitation is more complicated that this would suggest.

For a primary key a maximum of 20 fields will be permitted across both of the following objects:

Primary key definition
SumIndexField property.

For a secondary key a maximum of 20 fields will be permitted across all three of the following objects:

Primary key definition
Secondary key definition
SumIndexField property.

For example, NAV will behave as follows for a secondary key definition:

10 primary key fields, 5 secondary key fields and 5 SumIndexFields would work
10 primary key fields, 5 secondary key fields and 6 SumIndexFields will cause an error
10 primary key fields, 6 secondary key fields and 5 SumIndexFields will cause an error
11 primary key fields, 5 secondary key fields and 5 SumIndexFields will cause an error

When this limitation is exceeded NAV will generate the following error message when trying to save the table definition:

“The fields in an active key may not exceed 252 bytes. The sizes of the <list of fields> key fields in the <table name> table is <number of bytes> bytes. You must reduce the number or length of the active fields.”

The above message is misleading as the underlying problem does not relate to the number of bytes in the key. The <list of fields> above will be replaced with a list of all secondary key fields and primary key fields but will not show any SumIndexFields. Also the <number of bytes> displayed will not correspond to the number of bytes in the key definition.

Gerard Conroy
Microsoft Dynamics NAV Support Engineer

image

Comments