Hello, I have an attribute rule that previously worked in Pro 2.7, but hasn't worked since updating to Pro 3+, I'm currently operating Pro 3.1.3. Below is the current version of the script after some troubleshooting, I'll be happy to post the original code that worked in 2.7 if that would be helpful.
Workflow: 1) EsmtPoly is created and manually split by other unrelated attributes; 2) EsmtPoly is split by the gSSURGO_2022polys_XYZ feature class
Attribute rule intent: If the EsmtPoly features overlap multiple gSSURGO polys, the result should be "Split req'd," but after splitting by gSSURGO polys, there should be exactly 1 match for the Within function, and therefore the result should be the MUSYM from the gSSURGO polys.
//check if the geometry has changed or not, if it didn't simply return
if ( Equals(Geometry($feature), Geometry($originalFeature))) return
var soils = featuresetbyname($datastore, "gSSURGO_2022polys_XYZ", ["MUSYM"], true)
var EsmtPoly = geometry($feature)
var sMatch = Within(EsmtPoly, soils)
var sCount = count(sMatch)
if (sCount != 1) {return "Split Req'd"
} else {
if (sCount == 1) {
var sType = first(sMatch)
return sType.MUSYM }}
I have been attempting to troubleshoot the script, and I've managed to get it to work so long as the result is the return "Split req'd" (which is an improvement). However, when I split by the gSSURGO polys, I receive this error (yes, the split properly intersects in two or more places):
Split failed. Geometry must intersect polylines and polygons in two or more places.
Failed to evaluate Arcade expression. [
Rule name: MUSYM within,
Triggering event: Insert,
Class name: EsmtArea,
GlobalID: {CA601BD9-DC07-42DC-8713-AD30C9E59FED},
Arcade error: Unexpected null,
Script line: 13]