Skip to main content

Generate ID Attribute Rule (Data Management Tools)

Summary

Creates an attribute rule that generates a unique value for a field from a query.

The tool creates a .csv file containing an ArcGIS Arcade attribute rule based on the inputs provided, a Python file that contains the code for generating sequences in the workspace, and an ID file for visualizing generated IDs.

Usage

  • The Output Folder parameter specifies the location where a folder will be created using the name of the input feature class. The output .csv file containing the attribute rule will use the name of the Input Table parameter value. If the tool is run multiple times, additional .csv files will be created in the folder.

  • After the tool runs, import the attribute rule and apply it to the dataset. If the dataset is in an enterprise geodatabase, you must be the data owner to apply the output template attribute rule.

    Learn more about importing attribute rules

  • When setting the ID Builder parameter's Sequence by lookup value, a database sequence will be generated for each distinct value in the intersecting dataset's Sequence by lookup field that is present at the time the attribute rule is created. Features created after the rule has been written will need to be manually included.

  • If an ID is required for a target feature, configure the ID field to disallow nulls.

Parameters

Label Explanation Data type

Input Table

The dataset that the new rule will be applied to.

Table View

Output Folder

The folder where the output .csv file will be saved. The name of the file will be taken from the Input Table parameter value.

Folder

Field

The name of the existing field the rule will be applied to.

Field

Expression

(Optional)

An SQL expression that limits the rows that the attribute rule will be applied to.

SQL Expression

Create Sequences

(Optional)

Specifies whether database sequences will be created in the specified workspace.

  • CheckedDatabase sequences will be created. This is the default.

  • UncheckedDatabase sequences will not be created.

Boolean

Definition Type

(Optional)

Specifies the method that will be used to define the format of the ID.

  • BuilderThe ID format will be constructed using the ID Builder parameter.

  • TableThe ID format will be defined from a table using the ID Definition Table parameter.

  • Code ValuesA configuration entry and sequence will be generated for each combination of coded values from the selected fields.

String

ID Builder

(Optional)

A set of format options that will define the attribute rule. This includes an SQL expression that will be used to apply different formats and sequences per asset, as well as padding, prefix, and suffix values.

A preview of the string will display in the Geoprocessing pane from the values entered in the format options.

Value table columns:

  • Filter SQLAn optional SQL expression that will be used to determine whether the sequence will be applied to the row.

  • DescriptionAn optional description of the entry that will be added to the rule settings in the attribute rule.

  • Sequence NameThe name that will be assigned to the database sequence. For enterprise geodatabases, the name must meet sequence name requirements for the database platform you're using and must be unique in the database. For file geodatabases, the name must be unique to the file geodatabase.

  • Starting ValueThe starting number of the sequence. If you do not provide a starting number, the sequence will start at 1. If you do provide a starting number, it must be greater than 0.

  • Increment ValueDescribes how the sequence numbers will be incremented. For example, if the sequence starts at 10 and the increment value is 5, the next value in the sequence is 15, and the next value after that is 20. If you do not specify an increment value, sequence values will increment by 1.

  • PrefixAn optional string or value that will be placed before the sequence value.

  • SuffixAn optional string or value that will be placed after the sequence value.

  • PaddingAn optional positive number that represents the number of digits in which zeros will be used to fill the unused digits. For example, a value of 5 will represent the sequence value of 1 as 00001.

  • SeparatorAn optional value that will be used to join the prefix, sequence, and suffix.

  • Sequence by lookupAn optional value that will be used to create unique sequences for each distinct value in the field.

Value Table

ID Definition Table

(Optional)

A table or record set that defines the ID format. This includes the SQL expression that will be used to apply different formats and sequences per asset, as well as padding, prefix, and suffix values.

The table must include the following fields:

  • WhereClause—An optional SQL expression that will be used to determine whether the sequence will be applied to the row.

  • Description—An optional description of the entry that will be added to the rule settings in the attribute rule.

  • SequenceName—The name that will be assigned to the database sequence. For enterprise geodatabases, the name must meet sequence name requirements for the database platform you're using and must be unique in the database. For file geodatabases, the name must be unique to the file geodatabase.

  • StartingValue—The starting number of the sequence. If you do not provide a starting number, the sequence will start at 1. If you do provide a starting number, it must be greater than 0.

  • IncrementValue—Describes how the sequence numbers will increment. For example, if the sequence starts at 10 and the increment value is 5, the next value in the sequence will be 15, and the next value after that will be 20. If you do not specify an increment value, sequence values will increment by 1.

  • Prefix—An optional string or value that will be placed before the sequence value.

  • Suffix—An optional string or value that will be placed after the sequence value.

  • Padding—An optional positive number that represents the number of digits in which zeros will be used to fill the unused digits. For example, a value of 5 will represent the sequence value of 1 as 00001.

  • Separator—An optional value that will be used to join the prefix, sequence, and suffix.

  • IntersectClass—An optional value that contains the full path to an intersecting dataset.

  • ClassIDField—An optional field value that will be used to create unique sequences for each distinct value in the field.

  • ClassFilter—An optional SQL expression that will be used to determine whether the sequence will be applied to the row in the intersecting dataset.

Record Set

Coded Value Fields

(Optional)

The fields that will be used to generate an SQL expression and configuration for an ID.

Field

Sequence By Intersect

(Optional)

The features from the intersecting dataset that will be used to generate unique ID values in the input features. The optional field value from the intersecting dataset will be used for the sequence by lookup value.

Value table columns:

  • Intersect ClassThe features from the intersecting dataset that will be used to generate unique ID values in the input features.

  • Row ID FieldThe optional field value from the intersecting dataset will be used for the sequence by lookup value.

Value Table

Derived output

Label Explanation Data type

Output Rule CSV

The output .csv file containing an Arcade attribute rule based on the inputs provided. This file is used to import the attribute rule to the dataset.

File

ID Definition Table

A table of the sequence definition configurations. This file can be edited and reused by the tool using the Definition Type parameter's Table option.

File

Python Sequence Script

The output Python sequence file. The file can be used in other workspaces or by anyone with permissions to create database sequences.

File

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes