Select to view content in your preferred language

Arcade question for using filtered geometry when insert feature

771
3
09-05-2023 10:21 PM
HNTZK46
Emerging Contributor

Hi, I am preparing an immediate calculation rule that does both insert and update Polygon layer based on attributes from a table layer.

What I am trying to make happen is just when a new record is created in a table, a new polygon feature is also created based on filtered attributes from table. Here, a geometry for the new feature will also rely on the filtered result, i.e. use the polygon geometry. The code that I prepared for the purpose unfortunately ended up with an error, saying "Field not found Shape". There is a "Shape" field in the polygon layer certainly; thus, I am stuck with this at the moment.

Much appreciated if someone knows what the wrong with my code is.
Thanks in advance for any ideas

 

 

 

 

 

 

Tags (2)
0 Kudos
3 Replies
JohannesLindner
MVP Alum

Arcade indeed doesn't recognize the Shape field. Geometry() uses the whole feature. For that to work, you need to load the park geometries.

// line 13
var polygFS = FeatureSetByName($datastore, "National_parks", ["*"], true)

// line 21
"geometry": Geometry(polygFilter),

 

You don't need to supply the GlobalID for inserts (line 20).

 


Have a great day!
Johannes
0 Kudos
MikeMillerGIS
Esri Frequent Contributor

Also, if you are updating the triggering feature, you should not include that in updates, that update should be in the results keyword.

https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-k...

0 Kudos
JohannesLindner
MVP Alum

As I understand it, they aren't updating the triggering feature. They are copying the new value of $feature.asst_info into the polygon fc. Name, Type, and Code in lines 48-50 are attributes of the polygon fc, not the triggering feature. They are superfluously set to the values that are already in there, probably a relic from copy/pasting that piece of code from the insert block.


Have a great day!
Johannes
0 Kudos