Identity attributes are strictly system-generated which means that values cannot be imported into an attribute of type Identity. The below example describes the recommend way to switch from an existing single occurrence attribute of type, e.g., String or Custom, to a new attribute of type Identity. We do not recommend changing type of the existing attribute to Identity.
Prerequisites
- Familiar with the SystemWeaver meta model building blocks (e.g., Items, Parts and Attributes)
- Familiar with the SystemWeaver Explorer Interface and common operations
- An installation of the SystemWeaver Explorer client (swExplorer)
- Assignment of the SW Architect role in the server
- An installation of the SystemWeaver Architect client (swArchitect)
- We strongly recommend that you do some testing in a test environment before making the change in your production environment
- Sole access to the database during update in production
Note: If you are wanting to import Identity attributes as part of a SystemWeaver XML import, see How to Import Identity Attribute Values. |
Removing the Original Attribute as Default
In the below example, the existing attribute "String ID" is a String type attribute allowing single occurrence. It is currently set as a "Default" attribute for items of type Design requirement. The plan is to use an Identity type attribute instead to set IDs.
As a first step, remove the attribute as a "Default". This will result in the attribute becoming an "Additional" attribute for those items that have a value, as shown below.
The above step is the way to maintain the existing values. It is not possible to copy them to an attribute of type Identity.
Create the new Default Identity Attribute
Next, create the new Identity type attribute and add it as a "Default" attribute on the item type.
You will want to set the same Sequence id prefix and counter as the original attribute had.
Set Current Sequence Value
To start the counter on the next available number, use the Set sequence value refactoring tool. If the last value used in the original attribute is 2, you will want to set the New sequence value to 2 and click Update. It will then show the last value used in the Current sequence value field.
In this way, the next item to be created will receive the next available number, in this case 3.