Hello!
I wonder if someone can help me to update an existing attribute rule. I initially created an attribute rule where a field will be populated with the attribute of the intersecting geometry.
I want to update the rule where if the point is placed outside of the geometry, the rule will update the field with a generic "Z00".
Unfortunately, my arcade knowledge is still very basic (I dont need to create rules often), so I am wondering if I can get help with this?
Here is the code:
var ZAreas = FeatureSetByName($datastore, 'GISZArea', ["ZArea"], true);
var OverlapZArea = Upper(DomainName(First(Intersects(ZAreas, Geometry($feature))), 'ZArea'));
if (isEmpty($feature.ZArea)){
return OverlapZArea;
}
return $feature.ZArea
The codes works well to update the ZArea field, but I would like to have the ZArea field updated with "Z00" if the point is place outside of the geometry.
Regards,
Justin
Hi Justin, I think the IIF statement would be a good fit for what you're trying to accomplish
https://developers.arcgis.com/arcade/function-reference/logical_functions/#iif
Give this a try:
var ZAreas = FeatureSetByName($datastore, "GISZArea", ["ZArea"], true);
var OverlapZArea = Upper(DomainName(First(Intersects(ZAreas, Geometry($feature))), 'ZArea'));
//If an interesect isn't found, return Z00, otherwise return the ZArea attribute from the
return IIf(IsEmpty(OverlapZArea), 'Z00', OverlapZArea.ZArea)
Thanks Nathan!
I'll give it a shot.