Attribute rule in python

904
6
Jump to solution
02-09-2021 06:22 AM
kirken
by
New Contributor III

Is there any way how to set attribute rule using python expression instead of Arcade???

 

Thanks

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Hi @kirken ,

To confirm Dan's suspicion, Attribute Rules will only work with Arcade expressions. You cannot create an attribute rule using Python as the expression. The link shared by @DanPatterson before uses Python to configure the Attribute Rule, but inside it is still using the Arcade expression defined as a string inside the Python script.

In short, if you want to use Attribute Rules you will always need Arcade...

View solution in original post

6 Replies
DanPatterson
MVP Esteemed Contributor

Well yes and no.

You can use a python script to use an Arcade expression.  See the example here

Add Attribute Rule (Data Management)—ArcGIS Pro | Documentation

 


... sort of retired...
JoeBorgione
MVP Esteemed Contributor

Is that actually used to fire a rule or just add one?

That should just about do it....
0 Kudos
DanPatterson
MVP Esteemed Contributor

both... python is the delivery... attribute rule is the package :beaming_face_with_smiling_eyes: Like Amazon (python home range)


... sort of retired...
0 Kudos
kirken
by
New Contributor III

Ok. I meant more like writing the script expression of the rule in python because it is quite complicated and currently uses some python libraries but I  guess i have to learn that arcade now..

0 Kudos
DanPatterson
MVP Esteemed Contributor

I don't think arcade imports python libraries


... sort of retired...
0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi @kirken ,

To confirm Dan's suspicion, Attribute Rules will only work with Arcade expressions. You cannot create an attribute rule using Python as the expression. The link shared by @DanPatterson before uses Python to configure the Attribute Rule, but inside it is still using the Arcade expression defined as a string inside the Python script.

In short, if you want to use Attribute Rules you will always need Arcade...