You can use the Attribute Rules view to view and manage existing rules as well as create rules. Rule management includes tasks such as changing rule properties, importing and exporting rules, deleting rules, and so on.
The Attribute Rules view displays existing attribute rules and their properties for a specific dataset. To create attribute rules or manage existing rules, you must access the view from the geodatabase as the data owner.
Learn more about attribute rules and their properties
Note:
The Attribute Rules view is read-only when accessed from an ArcGIS AllSource basic license, web feature layer, or database connection as a user who is not the data owner.
Open the Attribute Rules view
You can open the Attribute Rules view from the following locations:
- Catalog pane—Right-click a feature class or table and click Data Design > Attribute Rules.
- Contents pane—Right-click a layer or table and click Data Design > Attribute Rules.
- Ribbon—Select a layer or table in the Contents pane. On the Feature Layer tab set, click the Data tab, and click Attribute Rules in the Data Design group.
Navigational sections
When you open the Attribute Rules view, you can view the various rule types by clicking the Calculation, Constraint, or Validation tab. Existing rules are displayed on each tab with each row representing an individual rule. When you select a rule, the rule properties appear in the details pane on the right side of the view.
Configure the Attribute Rules view using the Columns and Filter buttons. You can modify the visible columns in the rule list using the Columns button. You can also filter the attribute rules by rule properties using the Filter button. The filter uses the visible columns in the rule list.
Element | Description |
---|---|
Use tabs to switch between the Calculation, Constraint, and Validation rule types. | |
Rules are listed in the grid section of the view. You can customize the columns to show more or less detail for each rule. | |
The details pane includes the properties of the selected rule from the grid and is also used to enter properties during the creation of rules. |
Configure the Attribute Rules view
When reviewing attribute rules, use the Columns and Filter buttons to customize the information displayed in the grid of the Attribute Rules view.
- Right-click the layer in the Contents pane and click Data Design > Attribute Rules.
The Attribute Rules contextual tab appears.
- Click the Columns drop-down arrow to enable the following columns to display in the grid:The Disabled, Rule Name, Subtype, and Release columns for each rule are displayed in the grid by default.
- Field—The field to which the calculation rule is applied.
- Editable—If the field specified for the calculation rule is set to be editable.
- Description—Text describing in detail the behavior of the attribute rule.
- Error Number—An error number that will be returned if the rule is violated.
- Triggers—Adds Insert, Update, and Delete columns to show the editing events that will trigger the rule.
- Disabled—If the rule is disabled.
- Exclude—If the rule will not be evaluated by the application or client.
- Release—Includes the Min Pro Release, Min Enterprise Release, and Min Arcade Release columns to show the compatibility of the attribute rule and an ArcGIS client release based on the script expression. See Compatibility of Arcade in script expressions for more information.
Once enabled, the columns appear in the grid of the Attribute Rules view for each of the rule types.
- Click the Filter drop-down arrow and configure a filter query.
When a filter is applied to the view, the Filter button is highlighted in blue.
Create an attribute rule
You can create attribute rules in the Attribute Rules view or use the Add Attribute Rule tool. Before you create an attribute rule, ensure the data source is supported for the rule type and there is an exclusive lock on the underlying dataset. This means that no connections or services can be accessing the dataset.
Note:
Adding attribute rules to a dataset impacts backward compatibility:- Once attribute rules are added to a dataset, it is incompatible with ArcMap or ArcGIS AllSource 2.0 and earlier. See Client and geodatabase compatibility for more information on functionality available when using mixed client and geodatabase releases.
- Newer Arcade functions impact what ArcGIS client releases can access the dataset with the attribute rule. See Compatibility of Arcade in script expressions for more information.
To create an attribute rule in the Attribute Rules view, complete the following steps:
- In the Catalog pane, browse to a geodatabase as the data owner.
Tip:
If the dataset is in an active map view, you can use the Contents pane. - Right-click a dataset and click Data Design > Attribute Rules.
The Attribute Rules contextual tab appears.
- In the Add Rules group on the Attribute Rules tab, click the button for the desired attribute rule type you want to create.
- Calculation Rule (Immediate or Batch)
- Constraint Rule
- Validation Rule
- Ready to Use Rules
The rule type selected is activated in the Attribute Rules view, and the details pane appears; here, you'll input details for the new rule.
- In the details pane of the Attribute Rules view, enter the properties for the new attribute rule:
Tip:
Some properties below are only applicable for specific rule types. Required properties for the rule type being created are indicated by a red asterisk .- Rule Name—A unique name for the rule
- Description—A description to be stored with the rule
- Subtype—The subtype to which the rule will be applied, if the dataset has subtypes
- Field—The name of the field to which the rule will be applied
- Editable—The check box that determines whether the field specified for the rule will be editable
- Expression—The Arcade expression that defines the rule:
- Use the Expression Builder to configure and verify an Arcade script.
- If there are syntax errors, the line number and reason are referenced in the error. To see the line numbers in the Expression Builder, right-click the expression text box and select Show Line Numbers.
- Learn more about authoring attribute rule script expressions
- Triggers—Editing events that will trigger the rule:
- Insert—The rule will be applied when a new feature is added.
- Update—The rule will be applied when a feature has been updated.
- Delete—The rule will be applied when a feature has been deleted.
- Execution—The setting to specify the evaluation behavior of the rule:
- Exclude from application evaluation—If checked, the rule will not be evaluated by the application or client and will be evaluated once edits are applied.
- Disabled—If checked, the rule will be disabled.
- Batch—If checked, the calculation rule will be a batch calculation rule and must be evaluated through a validation service.
- Error Number—An error number that will be returned if the rule is violated
- Error Message—An error message that will be returned if the rule is violated
- Tags—A set of tags to identify the rule
- Click the Save button on the Attribute Rules tab.
The attribute rule is created for the dataset.
Manage attribute rules
Once attribute rules are established on a dataset, you can view and manage them using tools in the Attribute Rules toolset and the Attribute Rules view. The arcpy.Describe function can be used on a dataset to print the attribute rule properties. You can also view the attribute rules on a dataset from the comma-separated values (.csv) file that is created when using the Export Attribute Rules tool.
The Attribute Rules view allows you to interact with attribute rules for the dataset or layer in which the view was opened. When the view is active, the Attribute Rules group contains tools and commands to manage rules. You can use these tools in conjunction with interacting with the view and details pane.
- Delete Rule—Delete the selected rule in the view.
- Import Rules—Import attribute rules from a .csv file.
- Export Rules—Export attribute rules to a .csv file.
- Enable Rule—Enable the selected rule in the view.
- Disable Rule—Disable the selected rule in the view.
- Save—Commit edits made in the view.
You can temporarily disable attribute rules on a dataset using the Attribute Rules view or the Disable Attribute Rules and Enable Attribute Rules tools. This can improve performance for bulk data loads and is useful when running the rule must be suspended.
To transfer attribute rules between existing datasets, use the Export Attribute Rules and Import Attribute Rules tools. The Export Attribute Rules tool uses a .csv file to store the definition of the attribute rule.
Attribute rules are created as a property of feature classes or tables in the geodatabase. They are included in the data transfer process with datasets in the geodatabase using copy and paste or the Export XML Workspace Document and Import XML Workspace Document tools. Data migration tools such as Feature Class To Feature Class and Table To Table do not transfer the attribute rules with the underlying dataset. For datasets that have batch calculation or validation rules, the Validation Status attribute is reset for the output dataset that is created.
Note:
Sequences that are referenced in the attribute rule script expression are included when using copy and paste and XML Workspace Documents to transfer datasets with attribute rules.
Modify existing rule properties
After attribute rules are created, you can modify certain properties using the Attribute Rules view. Making changes to an attribute rule requires an exclusive lock on the underlying dataset.
You can modify the following properties:
- Description
- Expression
- Triggers
- Disabled check box (under Execution section)
- Exclude from application evaluation
- Error Number
- Error Message
- Tags
- Evaluation order (Calculation rules)
To make changes to an existing attribute rule, complete the following steps:
- In the Catalog pane, browse to a geodatabase as the data owner.
Note:
If the dataset is in the active map view, you can use the Contents pane. - Right-click the dataset and click Data Design > Attribute Rules.
The Attribute Rules tab appears.
- In the Attribute Rules view, select the rule type for the rule you want to modify.
- Calculation
- Constraint
- Validation
- Select the rule that you want to modify by clicking the specific row.
The details pane displays the rule properties.
- In the details pane, make changes to any of the following rule properties:
- Description
- Expression
- Triggers
- Disable check box (under the Execution section)
- Exclude from application evaluation (under the Execution section)
- Error Number
- Error Message
- Tags
Tip:
Changes to certain rule properties require the rule to be deleted and re-created. Rule properties that cannot be modified are read-only. - For calculation rules only, optionally, change the evaluation order. Click the Calculation tab in the view. In the rule list section of the view, modify the Order column value for the rule you want to move in the evaluation order.
- Click the Save button on the Attribute Rules tab.
Copy attribute rules between datasets
Once you have attribute rules established on a dataset, you may find that they would be beneficial on other datasets you own. There are a few ways to copy attribute rules of the same rule type between datasets. You can do the following:
- Copy and paste
- Export and import attribute rules
Note:
To apply a subtype to an attribute rule you will need to do so after the attribute rules are copied or imported into the destination dataset.
Copy and paste
Copy and paste in the Attribute Rules view is supported using keyboard shortcuts, context menu, and clipboard. To copy an attribute rule between datasets, complete the following steps:
- Open the Attribute Rules view on the origin dataset that contains the attribute rule of interest and the destination datasets that you want to add the attribute rules to.
The attribute rules view opens for the origin and destination datasets.
- From the origin dataset that contains the attribute rule, click the rule type and select the attribute rule that you want to copy to the destination dataset.
The attribute rule is selected
- Copy the selected attribute rule using either copy from the Clipboard, keyboard shortcut for copy, or copy within the context menu.
- In the destination dataset, click the rule type that matches the attribute rule copied from the origin dataset and paste using either paste from the Clipboard, keyboard shortcut for paste, or paste in the context menu.
The attribute rule is added to the destination dataset.
- Click the Save button on the Attribute Rules tab.
The attribute rule is saved in the destination dataset.
Export and import attribute rules
Exporting and importing can be useful for sharing attribute rules or creating a backup of the rules for a dataset. Exporting attribute rules on a dataset creates a comma-separated values (.csv) file that you can use to import into a destination dataset. The .csv file contains metadata information about the attribute rule and the Arcade script.
You can use Export Rules in the Attribute Rules group on the Attribute Rules contextual tab or the Export Attribute Rules geoprocessing tool. To export attribute rules for a dataset, complete the following steps:
- Open the Attribute Rules view on the dataset that you want to export the attribute rules from.
The attribute rules view opens for the dataset.
- From the Attribute Rules contextual tab, click the Export Rules button. The Export Rules button is located in the Attribute Rules group.
The Export Rules dialog box appears.
- Browse to the folder where you want to save the .csv file, enter a name for the file, and click Save.
The attribute rules for the dataset are saved in a .csv file at the specified location.
To import attribute rules, you can use Import Rules in the Attribute Rules group on the Attribute Rules contextual tab or the Import Attribute Rules geoprocessing tool. To import attribute rules for a dataset, complete the following steps:
- Open the Attribute Rules view on the dataset that you want to import the attribute rules to.
The attribute rules view opens for the dataset.
- From the Attribute Rules contextual tab, click the Import Rules button. The Import Rules button is located in the Attribute Rules group.
The Import Rules dialog box appears.
- Browse to the folder where you have the exported attribute rules .csv file, select the .csv file, and click OK.
The attribute rules for the dataset are added to the Attribute Rules view.
- Click the Save button on the Attribute Rules tab.
The attribute rules are saved in the destination dataset.