Assign UniqueID
Description
Populate values for an existing unique ID field in a user specified layer. Field to be populated is selected by the user from a list of viable fields for the specified input layer. Supported fields are of integer, string, and GUID type. The field must be present in the input layer.The following techniques are used to populate the fields of type:
Integer. The assigned value will be based on the LASTID field value in the ApUniqueID table residing in the same workspace where the input layer resides. If the entry does not exist for the field in the ApUniqueID table, it will be created and set to 0.
String. String is assigned using Python uuid.uuid4 function, resulting in a string of 36 characters, e.g. 8d838c19-b120-48b6-b5d9-c7cb7be50cc9. Note that the field must have adequate length (36 characters or more).
GUID. GUID is assigned using Python uuid.uuid4 function, resulting in a sequence of 36 characters wrapped in curly brackets, e.g. {2B966888-9DC9-4989-9F6A-E25665F55822}. Note that the letters will be upper case.
If "Overwrite UniqueID" option is checked, all selected records will be assigned a new unique ID and any existing values will be overwritten. If the option is not checked, only records with field values <null> will be populated.
If needed, the tool will do the following:
- If the input field is of integer type and the ApUniqueID table is not present in the required workspace, it will create the ApUniqueID table.
- If the ApUniqueID table is present, but the IDNAME field does not have a reference to the selected field, it will be added and its LASTID value set to 0.
Usage
Parameters
Parameter Name | Type | Direction | Data Type | Dialog Reference |
---|---|---|---|---|
Input Layer | Required | Input | Table View | Table/layer for which to apply UniqueID assignment. |
UniqueID Field | Required | Input | Field | Field within selected table/layer for which to apply UniqueID assignment. Field type should be Integer, String, or GUID. |
Overwrite UniqueID | Optional | Input | Boolean | If "Overwrite UniqueID" option is checked, all selected records will be assigned a new unique ID and any existing values will be overwritten. If the option is not checked, only records with field values <null> will be populated. |