Specialized Attributes

Primary Keys and Sequence Numbers

Each record in a repository has a unique record ID attribute called a key. The record’s unique, identifying key is called its primary key. Primary keys are often auto-generated.

If the primary key is an auto-sequenced attribute field and EnterWorks has been configured to allow the user to set its value, if the user enters a value, it will be saved. If the user has not, EnterWorks will generate the field value based upon the next number in the sequence and any configured rules. Once the new record is saved, the value of the auto-sequenced field is typically configured so that it cannot be changed. EnterWorks can be configured to generate unique identifiers across a set of repositories, so no duplicate identifiers will be generated or saved.

If the record’s primary key is not auto-generated and the user does not enter a primary key, the field will be left empty and an error for the record will be generated. If the user enters a value in a primary key attribute that has been used elsewhere in the repository, a duplicate identifier error for the record will be generated. EnterWorks may also be configured to ensure that within a set of repositories, no duplicate identifiers are generated or saved.

Note: A record’s primary key may be edited using the Attribute Value Editor in a Repository View if the user has sufficient permissions. This should not be considered common practice and great care must be taken when modifying a primary key, as the key can be referenced in numerous database tables and reports. Changing a primary key that is referenced by other repository records will effectively break the link from those records, unless the same change is made to those records as well.

A record’s primary key is not to be confused with its sequence number. A sequence number only describes the order in which records are displayed in a Repository View, it is not used to identify the record.

Repository Sequences

Each record in a repository needs a unique ID to identify it. These IDs are tracked via a sequence object (also called a sequence or sequence definition), which keeps track of the IDs that have been used in that repository.

A sequence can be shared by multiple repositories, which would guarantee that each record has a unique id across all the repositories using that sequence. A use for this would be if products were being entered in multiple repositories but each product needed a unique product ID. Although a sequence definition can be shared by multiple repositories, it is recommended as best practice to create a separate sequence definition for each repository.

The default sequence object is commonly used if the user doesn’t care what the sequence numbers are as long as they uniquely identify each record.