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
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).
Also, if you are updating the triggering feature, you should not include that in updates, that update should be in the results keyword.
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.