Hello I am working on a calculation rule that inputs the nearest school district from a polygon feature. The problem I am having is that the rule is bringing back the school district that the polygon is within. I would like it to calculate the nearest (if any) school district within 1 mile. Is this possible. I have the following below.... Thanks in advance.
var SCHOOL_DIST = FeatureSetByName($datastore, "SCHOOL_DIST", ["NAME"]);
VAR SEARCHDISTANCE = 1;
VAR SCHOOLINTERSECT = INTERSECTS(SCHOOL_DIST, BUFFER($FEATURE, SEARCHDISTANCE, "MILE"))
VAR FSCHOOL = FIRST(SCHOOLINTERSECT)
IF (FSCHOOL == NULL) RETURN ""
RETURN FSCHOOL.NAME