Attribute Rule - FAQ

8765
10
07-21-2020 12:16 PM

Attribute Rule - FAQ

This document will be used to respond to commonly asked questions on attribute rules.  Please add comments below or contact the attribute rule space owners to request additional questions to be added to the FAQ. 

 


Is there a way to migrate my attribute assistant methods to attribute rules?

Attribute rules are extremely flexible to configure behavior that is specific to your needs. There is no 1-to-1 migration process, but you can review the list of resources below and posts on GeoNet to learn how to configure attribute rules to perform what you need. 

 

How can I learn more about Arcade?

The Arcade team has compiled a great blog post that includes the most common questions check it out! - Your Arcade Questions Answered 

 

How can I start to write my first attribute rule?

It depends on what format you are most comfortable with, we recommend you watching Attribute Rules in Arcade (From Scratch) - Demo Theater  video which will start from scratch creating a file geodatabase, create feature classes, attribute rules and then execute those rules. No Arcade experience is required.  

 

Do attribute rules work with Collector?

Using Collector to edit a layer that has attribute rules will trigger immediate calculation and constraint rules on the server. But, editing an offline map will not trigger these types of attribute rules until the edits are synced. 

 

Are attribute rules supported in ArcGIS Online?

Currently, attribute rules are not supported in hosted feature layers in ArcGIS Online.  

 

Why can't I open a feature class in ArcMap after adding an attribute rule with ArcGIS Pro?

Attribute rules are not supported in ArcMap. Adding an attribute rule to a feature class upgrades the feature class to work with a minimum of Pro 2.1. When adding an attribute rule to a feature class in a feature dataset, the entire feature dataset is not accessible from ArcMap. You might be able to view some of the other feature classes in the feature dataset, but you won't be able to edit. 

 

Why can't I open a feature class in an older version of ArcGIS Pro after adding an attribute rule?

Adding an attribute rule to a feature class upgrades the feature class to work with a minimum of Pro 2.1. Some Arcade functions are released with a specific Arcade version. This impacts what ArcGIS client release can access the feature class once an attribute rule using the function has been added. When a newer Arcade function is used in the attribute rule script expression, the feature class will be upgrade to the geodatabase version that corresponds to when that function was released. For example, FeatureSetByName was introduced with Arcade 1.5, which means using this function in an attribute rule will upgrade the feature class to work with a minimum of Pro 2.3 and Enterprise 10.7. Using the Geometry function will require a minimum of Pro 2.1 and Enterprise 10.6 because it was part of the first release of Arcade. Reference the ArcGIS Arcade Version matrix and Release notes for more information. 

 

What is Exclude from Application Evaluation option used for?

We get this question alot , here is a blog explaining the motivations and use cases behind this here.

Comments

Having attribute rules not available in AGOL/Portal is a HUGE negative.

Attribute Rules need to become available in AGOL in order for GIS professionals to transfer over to ArcGIS Pro. What alternatives are available when bringing datasets in ArcGIS Online into ArcGIS Pro to edit with Attribute Rules now?

I am also wondering what alternative there is to an attribute rule for a hosted feature layer, until available in AGOL. I echo the sentiments that they are needed in AGOL.

 

 

Hello, I wondering if we can create Attribute rule for checking duplicate value or not allow to have duplicate value in attribute field.

 

 

Hi @PhallyGnean ,

Maybe it is better to enforce a unique value by using a Calculation Attribute in combination with a database sequence. See: https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-script-expre... 

Your Constraint or Validation Attribute Rule could also check to see if a value is unique. However, if you have a large dataset this could have an impact on performance.

@PhallyGnean if you're using it, Data Reviewer offers this as a Unique Field Value check without needing customising.

As @XanderBakker said, you can also write your own validation or use a sequence.  Their advice is pretty much what we're implementing for data integrity/validation.

Thanks so much to @XanderBakker and @AndrewQuee for being help. Let's me try.

@PhallyGNP  to expand on Xander's good answer and the linked documentation, if you want to go down the "sequence as unique ID" route you need to create a database sequence (and will need rights to do so)  in the schema the dataset is in.

e.g. 

CreateDatabaseSequence(Connection.sde, MyNewSeq_name, {seq_start_id}, {seq_inc_value})

where optionally start_id is the start number and inc_value is the increment.  If you have no existing values you want to use, these can be omitted.  In my work we are often importing/migrating existing incrementing IDs/sequences, so we absolutely do not want to overrun sequences and reuse IDs.

Pair this with a calculation rule as Xander mentioned.  Here's a simple example to get you started:

AndrewQuee_0-1637109415999.png

Note!  In this case Exclude from Application evaluation must be enabled  for reasons which I hope are obvious.  This case is for a persistent ID that does not change through the life of the feature.  If you wanted a unique ID for every change, tick trigger on Update as well.

 

Finally it's also worth mentioning (reviewing your original question) that Pro supports Add GlobalID which is a unique ID generator completely managed by the system.  You don't have to do anything with it and it requires no rules or Arcade. It Just Works if uniquely identifying features is what you're looking for, don't need to match/customise existing sequences and don't care what the ID is or looks like.  (It'll be a UUID which is like  a Windows GUID and look a lot like "0fa8df96-4742-11ec-81d3-0242ac130003")

If I have an attribute rule defined to trigger on update, will it evaluate if I am simply running an update sql query in my database editing environment ?  eg.  SQL Server Management Studio

We are having a few challenges trying to migrate to Attribute Rules from Attribute Assistant - our challenges currently are:
1. When a point is created, we would like to get the Name from an intersecting polygon (neighborhood, park name, zip code, city, etc) from a FC that is in the map from another database on the same ArcGIS Server instance.  The fact that Attribute Rules can only work between data in the same database is not working for us - we are having to make duplicate copies of those layers into our database, and in some cases a View to another database - if our DBA will let us get readonly permissions to the other database for one of our logins. 
2. Not being able to use a geocoder to fill in an address is also a hang up... we are going to have to copy our constantly updated address layer in, and use nearest neighbor... it's making more work.

Finally, and not related - we also tried to make an incremental id and have been given a work around to make a db sequence, but we first hit the wall of Pro being updated frequently - which gives us access to new Arcade versions, but when we tried to publish the layer with that Attribute Rule attached onto our Portal that is only updated every couple of years... the rule was incompatible as it was too new.. 

Until there are replacements for all these items we had in Attribute Assistant, we are getting to do a lot more manual tasks... not making me feel warm and fully about having to replace ArcGIS Desktop with ArcGIS Pro, which is no longer under maintenance for security patches, so we are being urged to uninstall it 😞

Version history
Last update:
‎04-08-2021 10:37 AM
Updated by:
Contributors