You can configure a repository to automatically generate unique sequential attribute values by creating a sequence definition object and configuring the repository to use the sequence definition object. It is possible to configure multiple repositories to use the same sequence definition object so that the attribute values are unique across the set of repositories. There can be only one auto-sequenced attribute per repository. Auto-generated sequence attributes are often used as record IDs.
Configuring a repository to automatically generate a unique sequential attribute is a change to the data model. It involves clearing the cache and perhaps updating the snapshot table, which can take a while and may make data in the snapshot table unreliable until the process is finished. Therefore is recommended that you make data model changes during non-business hours.
To configure a repository to automatically generate unique sequence attribute values:
- If the sequence definition object you want to use does not exist, create it.
- If the attribute that will be used to store the sequence numbers has not already been
added to the repository's profile, add it:
- Open the repository's profile for editing by opening the Feature bar, opening the repository's folder, selecting the desired repository, selecting Manage Model, and selecting Profile.
- Click the Next button to move to the Define Attributes page.
- An attribute must be defined to hold the sequence number. Select New from the Action dropdown menu or select an existing attribute and select Edit.
- Edit the attribute's configuration options:
- Name (Required) Do not include special characters in the name, such as & < > ". This is a multi-language value.
- Restricted Name: (Required) The relational database snapshot column name. Typically, this is comprised of only alphanumeric and underscore characters. The auto-conversion function will change any blank characters to underscores. Do not include special characters in the name, such as & < > ".
- Description: (Optional) This is a multi-language value.
- Group: (Required) Select the attribute group.
- Data Type: Select BIGINT or VARCHAR. Use VARCHAR if your sequence will include characters in its prefix or if you will be using the attribute as a join attribute in a link relationship and the other repository's join attribute is VARCHAR.
- Data Size: If the attribute is of type VARCHAR, set the Data Size larger than the longest sequence you expect to generate. Data Size is often set to 10.
- Is Required: This attribute will be required.
- Is Primary Key: If this attribute is the record's unique identifier, check this.
- Seq Gen Ind: Check this.
- Click the OK button to save the attribute.
- Click the Save button to save the profile.
- Clear the data cache.
- If the sequence attribute in the repository is not already in the snapshot table, consider adding it to the snapshot table. Sequence attributes are often used in searches and as join attributes for link relationships, so it is a good practice to have them in the snapshot table.
- Configure the repository to use the sequence definition by editing the repository's
properties:
- Open the repository's Properties editor by opening the Feature bar, opening the Content folder, opening the repository folder, clicking the repository, selecting Edit, then selecting Properties.
- Set the Sequence: Use the dropdown menu to select the sequence definition option. Add to repository properties: Set this to default or the one you are using.
- Click the Save button.
- Clear the data cache.