Creating, Editing, and Deleting a Unique Key

You can create unique keys designed to ensure that two objects cannot be saved with the same values for a set of chosen attributes.

This task shows you how to:

Create a Unique Key

You can create a unique key to make sure that two objects cannot be saved with the same values for a set of chosen attributes.

Before you begin: Create a specialization or a deployment package. For more information, see Creating a Specialization Package or Creating a Deployment Package.
  1. From the sidebar, do either of the following:
    • To create a unique key for a specialization package, select Specialize Data Model.
    • To create a unique key for a deployment package, select Administrate Data Model.
  2. From the List of [Specialization|Deployment] Packages, click the package for which you want to create a unique key.
  3. If you are creating a unique key for a deployment package, select Categories > Unique Keys.
  4. In the Unique Keys tab, click New Key .
    The Create New Unique Key window opens.
  5. Define the unique key as follows:
    1. In the Name field, enter a name for the unique key.

      Note: Names can only contain alphanumeric characters and the underscore character.

    2. Next to the Types field, click ... to display the Types List. This list shows the types to which the key can be applied.
    3. In the Types List window, click one of the types and click Submit.
    4. Select the type extension to be constrained by the key.
    5. Click Done when you are finished with the key creation.

Result: The key appears in the Unique Keys List window.

  • Name corresponds to the key name.
  • Constrained Type (Owner Package) shows the package containing the type constrained by the key.
  • Constrained Extension (Owner Package) shows the list of the constrained extensions.
Notes:
  • Attributes can be taken from the type and/or the extension, if any. A unique key can also constraint some basic attributes such as revision, owner, originated.
  • You cannot create unique keys for multiline and multivaluated attributes.
  • The attributes constrained by the unique key are those that are checked.
  • The unique key is only applied to objects that have the type extension you specified in step 3.d. To automatically add a type extension to an object, either select true from the Automatic addition list when creating a deployment extension, or create a business rule. For more information, see Creating and Deleting a Deployment Extension and  Create a Business Rule.

What's Next
Next, activate the unique key. For more information, see Manage Unique Keys: Activating Unique Keys.

Edit a Unique Key

You can remove an attribute from the unique key.

  1. Select the check box located next to the Attribute you want to delete.
  2. Click Modify List of Constrained Attributes .
    The attribute is removed.

Delete a Unique Key From the User Interface

You can delete a unique key provided it is not activated. if it is, deactivate it first, then delete it.

In the Unique Keys tab, select the unique key that you want to delete, and click Delete .

Delete a Unique Key Using a Shell Script

You can delete a unique key using the CustoDataTool2.sh shell script even if it is activated.

Note: When the -deleteAbsent argument is declared, the metadata file is imported and all missing entities are deleted.

Open a command window and enter the following command: <intall_directory>/server/scripts/CustoDataTool2.sh -file on Unix and CustoDataTool2.bat on Windows.
For example, enter CustoDataTool2.sh –password creatorPassword -file /tmp/CustoPackage.zip –deleteAbsent.