Hi All,
I have tested below Arcade expression in ArcGIS Arcade Playground and got error saying that $datastore variable is not found. To solve this issue, i have selected globals drop down value as "Attribute rule calculatoin" and script executed successfully.
var fsTerrainPolygon = FeatureSetByName($datastore,"Polygon",["COUNTRY_NAME"])
var fsIntersectCountry = Intersects(fsTerrainPolygon,$feature)
var fCountry = first(fsIntersectCountry)
if (fCountry == null)
return " "
return fCountry.COUNTRY_NAME
Now The same script, i am trying to utilize in the attribute rule creation. Please find the script below.
import arcpy
in_table = r"featureclass_path"
name = "CaptureCountryName"
script_expression = 'var fsTerrainPolygon = FeatureSetByName($datastore,"Polygon",["COUNTRY_NAME"]) var fsIntersectCountry = Intersects(fsTerrainPolygon,$feature) var fCountry = first(fsIntersectCountry) if (fCountry == null) return " " return fCountry.COUNTRY_NAME'
triggering_events = "INSERT;UPDATE"
description = "Capture CountryName From Python Script"
field = "COUNTRY_NAME"
arcpy.AddAttributeRule_management(in_table, name, "CALCULATION", script_expression, "NONEDITABLE", triggering_events, "", "", description, "",field)
Getting below error.
ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Failed to execute (AddAttributeRule).
In the script_expression - if we give any arcade expression without globals, script is working without any issues.
(i.e script_expression = 'if (1 == 0) {return "Fail"} else {return "Success" --> complete scripts executes without any issues}'
Please let me know, how can add execution profile for this script or how to resolve this issue.
FYI: Even alterattributerule management is also has same issue.
Thanks,
Sreeni.