Dictionary keywords expose advanced behavior of attribute rule functionality, such as returning custom error messages in conditional statements or performing edits to features in another feature class. When authoring ArcGIS Arcade expressions for attribute rules, the return dictionary type must use one of the reserved keywords listed below. To perform multiple operations, extend the dictionary with different keywords. To learn more about how to use these dictionary keywords, see Attribute rule script expression examples.
Note:
When defining globalD or globalIDs keyword parameters, ensure the value is enclosed in single quotation marks.
result
Provides a return of a single value or a dictionary for the feature. You can only use this keyword with calculation rules.
When using the result keyword to return a single value, you must define a target field in the attribute rule to update the correct field. You can return a result as a dictionary to update multiple fields of the feature. When returning a result as a dictionary, the target field in the attribute rule is optional. You can specify any field to update in the dictionary using the keyword parameters in the table below.
When the target field is defined in the attribute rule and you are returning a result as a dictionary:
- If the target field is in the dictionary, the target field is updated with the value defined in the dictionary.
- If the target field is omitted from the dictionary, no change is made to the target field.
Caution:
The keyword parameters for a result in an attribute rule is only supported with ArcGIS Pro 2.7 or ArcGIS Enterprise 10.9 and later.
Keyword parameter | Description |
---|---|
attributes | Edits specified fields. The value is a dictionary of field name and attribute pairs. |
geometry | Edits the geometry. The value is a Geometry object. |
return {
//result is a single value
'result': 200
}
return {
//result is a dictionary
"result": {
"attributes": {
"field1": 'field1', //updates field1 in the $feature
"field2": 11 //updates field2 in the $feature
},
"geometry": Rotate($feature) //updates geometry in $feature
}
}
errorMessage
Specifies a user-defined error message for a failure during evaluation. Use the errorMessage keyword when creating logical statements in Arcade expressions to return custom error messages. When returning errorMessage, no other dictionary keyword can be used. See an example of how to return a custom error message.
return {
"errorMessage": "Error message text"
}
calculationRequired
Marks other features as requiring evaluation of batch calculation rules. When this keyword is used, the corresponding feature or features are marked as requiring calculation by modifying the Validation Status attribute. This keyword can only be used with calculation rules, and the Exclude from application evaluation option must be set to true. See an example of how to mark other features as requiring evaluation.
Keyword parameter | Description |
---|---|
className | (required) The name of the feature class or table to modify. The value is the feature class name. |
objectIDs | globalIDs | (required) An array of ObjectIDs or GlobalIDs to modify. The value is an array of ObjectIDs or GlobalIDs. |
return {
'calculationRequired': [{
'classname': 'featureclass_name',
'globalIDs': ['{8B421724-32D0-408A-A8EE-CCC2B064D52B}']
}]
}
validationRequired
Marks other features as requiring evaluation of validation rules. When this keyword is used, the corresponding features are marked as requiring validation by modifying the Validation Status attribute. This keyword can only be used with calculation rules, and the Exclude from application evaluation option must be set to true. See an example of how to mark other features as requiring evaluation.
Keyword parameter | Description |
---|---|
className | (required) The name of the feature class or table to modify. The value is the feature class name. |
objectIDs | globalIDs | (required) An array of ObjectIDs or GlobalIDs to modify. The value is an array of ObjectIDs or GlobalIDs. |
return {
'validationRequired': [{
'classname': 'featureclass_name',
'globalIDs': ['{60905A3D-9783-435D-B4C9-AA4ADA59AD32}']
}]
}
edit
Performs inserting, updating, and deleting features in specified feature classes. The edit keyword can only be used with calculation rules, and the Exclude from application evaluation option must be set to true. See an example of how to edit another feature class.
For a utility network, you can use the edit keyword to edit the association of the $feature using the associationType keyword. To edit any association in the utility network, set the className value to ^UN_Association. The ^UN_Association gives you access to the utility network associations table to edit any association between features when using the associated keyword parameters for adds and updates.
Learn more about utility network associations
Note:
Using the ^UN_Association value for className and the associated keyword parameters are only supported with ArcGIS Pro 2.7 or ArcGIS Enterprise 10.9 and later.
Keyword parameter | Description |
---|---|
className | (required) The name of the feature class or table to modify. The value is the feature class name. |
The type of edit to make. The value is an array of dictionaries detailing the edits for each edit type. |
Note:
Do not create a script that performs recursive edits. If a script is configured to perform an edit that triggers or evaluates the attribute rule, an infinite loop is created. This causes unintended results.
adds
Keyword to use in the edit dictionary to perform inserts to a specified feature class or table.
Keyword parameter | Description |
---|---|
attributes | Edits specified fields. The value is a dictionary of field name and attribute pairs. |
geometry | Edits the geometry. The value is a Geometry object. |
associationType | Edits the association of the $feature in a utility network. Possible values include the following:
The following are additional possible values for utility network version 4 and later:
|
fromTerminal | The from terminal to edit when associationType value is connected, junctionEdgeFrom, or junctionEdgeTo. The value is the terminal name. |
toTerminal | The to terminal to edit when associationType value is connected, junctionEdgeFrom, or junctionEdgeTo. The value is the terminal name. |
isContentVisible | Specifies whether the content is visible for a containment association. The value is true or false. |
percentAlong | The percent along a line or edge when associationType is midspan. The value is a percentage ranging from 0 to 1. |
tag | Sets a tag for a feature or record that hasn't been created yet. You can reference the tag value in other parts of the edit dictionary such as the fromGlobalID or toGlobalID keywords when editing the ^UN_Association. The value is a string that is unique. Note:Using the tag is only supported with ArcGIS Pro 2.7 or ArcGIS Enterprise 10.9 and later. |
Keyword parameters to add an association when the className is set to ^UN_Association.
Keyword parameter | Description |
---|---|
fromClass | (required) The feature or object class name participating in the association. |
fromGlobalID | (required) The GlobalID of the feature or object. |
toClass | (required) The feature or object class name participating in the association. |
toGlobalID | (required) The GlobalID of the feature or object. |
associationType | (required) The type of association between the features in a utility network. Possible values include the following:
The following are additional possible values for utility network version 4 and later:
|
fromTerminal | The from terminal for a connectivity association. The value is the terminal name. |
toTerminal | The to terminal for a connectivity association. The value is the terminal name. |
isContentVisible | Specifies whether the content is visible for a containment association. The value is true or false. |
percentAlong | The percent along a line or edge when associationType is midspan. The value is a percentage ranging from 0 to 1. |
return {
'edit': [{
'className': 'b_edit_dict',
'adds': [{
'attributes': {
'field_name': 11
},
'geometry': Geometry({
'x': -76.8375008,
'y': 39.4949383,
'spatialReference': {
'wkid': 4326
}
})
}]
}]
}
"edit": [{
"className": "ElectricDistributionJunctionObject",
"adds": [{ //adds a new Electric Distribution Junction Object and creates and midspan association to the $feature
"percentAlong": 0.5,
"associationType": 'midspan'
}]
}]
}
//$feature is an edge object in the utility network
//The arcade will add two junction objects and associate them to the $feature
//The junction object with asset group 5 and asset type 1 has a terminal configuration of High/Low
return {
"result": $feature.assetid,
"edit": [{
"className": "ElectricDistributionJunctionObject",
"adds": [{
"attributes": { //Adds a junction object
"assetgroup": 5,
"assettype": 1
}, //create a connectivity association between the $feature and junction object
"toTerminal": "High", //to the high side terminal of the junction object
"associationType": "junctionEdgeFrom" //on the from side of the edge object
}, {
"attributes": { //Adds a junction object
"assetgroup": 5,
"assettype": 1
}, //create a connectivity association between the $feature and junction object
"toTerminal": "High", //to the high side terminal of the junction object
"associationType": "junctionEdgeTo" //on the to side of the edge object
}]
}]
}
return { //creates two new Structure Junction Objects and creates an association between them using a tag
"edit": [{
//create two junction objects and identify them uniquely with a tag
"className": "StructureJunctionObject",
"adds": [{
"tag": "jo1", //unique identifier for new feature in the Structure Junction Object class
"attributes": {
"AssetGroup": 1,
"AssetType": 2
}
}, {
"tag": "jo2", //unique identifier for new feature in the Structure Junction Object class
"attributes": {
"AssetGroup": 1,
"AssetType": 2
}
}]
}, {
"className": "^UN_Association", //edit the association table create a attachment association between the new junction objects
"adds": [{
"fromClass": "StructureJunctionObject",
"fromGlobalId": "jo1.globalID",
"toClass": "StructureJunctionObject",
"toGlobalId": "jo2.globalID",
"associationType": "attachment"
}]
}]
}
updates
Keyword to use in the edit dictionary to perform updates to a specified feature class or table.
Keyword parameter | Description |
---|---|
objectID | globalID | (required) The ObjectID or GlobalID value of a feature to edit. The value is an ObjectID or GlobalID. |
attributes | Edits specified fields. The value is a dictionary of field name and attribute pairs. |
geometry | Edits the geometry. The value is a Geometry object. |
associationType | Edits the association of the feature in a utility network. Possible values include the following:
The following are additional possible values for utility network version 4 and later:
|
fromTerminal | The from terminal to edit when associationType value is connected, junctionEdgeFrom, or junctionEdgeTo. The value is the terminal name. |
toTerminal | The to terminal to edit when associationType value is connected, junctionEdgeFrom, or junctionEdgeTo. The value is the terminal name. |
isContentVisible | Specifies whether the content is visible for a containment association. The value is true or false. |
percentAlong | The percent along a line or edge when associationType is midspan. The value is a percentage ranging from 0 to 1. |
Keyword parameters to update an association when the className is set to ^UN_Association.
Keyword parameter | Description |
---|---|
isContentVisible | Specifies whether the content is visible for a containment association. The value is true or false. |
percentAlong | The percent along a line or edge when associationType is midspan. The value is a percentage ranging from 0 to 1. |
return {
'edit': [{
'className': 'b_edit_dict',
'updates': [{
'globalID': '{7EBAB596-E9DB-40D8-9756-B2EBED2500B7}',
'attributes': {
'field_name': 22
}
}]
}]
}
return {
"result": $feature.assetid,
"edit": [{
"className": "electricdistributionassembly",
"updates": [{
"objectID": feature_objectid,
"associationType": 'container'
}]
}]
}
deletes
Keyword to use in the edit dictionary to perform deletes in a feature class or table.
Keyword parameter | Description |
---|---|
objectID | globalID | (required) The ObjectID or GlobalID value of a feature to edit. The value is an ObjectID or GlobalID. |
return {
'edit': [{
'className': 'b_edit_dict',
'deletes': [{
'objectID': 22
}]
}]
}