Hi there,
I have a rule where I am trying to see if a line intersects a specific polygon. I was using First, but realized the rule wouldn't flag if it went through another polygon first, then intersected my flag polygon. Is there a way to return a list and then flag if my polygon(cab_id == 'SDY-HUT') is in that list? This is the code I am using.
var cabs = FeatureSetByName($datastore, "Proposed_OLT_LCP_Boundaries_copy", ["cab_id"])
var cabsInt = Intersects(cabs, $feature)
var cabSpliceInt = First(cabsInt)
if (cabSpliceInt == null) return {"errorMessage": "Please edit inside a cabinet boundary"}
if (cabSpliceInt.cab_id == 'SDY-HUT')
return false;
else return true;
Thanks!
Solved! Go to Solution.
You can continue using first but first (no pun) you have to add an additional filter against the polygon you want. Push the query all the way to the DB.
var cabs = FeatureSetByName($datastore, "Proposed_OLT_LCP_Boundaries_copy", ["cab_id"], false)
var filteredCabs = filter(cabs, "cab_id='SDY-HUT'")
var cabsInt = Intersects(filteredCabs , $feature)
var cabSpliceInt = First(cabsInt)
if (cabSpliceInt == null) return {"errorMessage": "Please edit inside a cabinet boundary"}
return true;
var cabs = FeatureSetByName($datastore, "Proposed_OLT_LCP_Boundaries_copy", ["cab_id"])
var cabsInt = Intersects(cabs, $feature)
// just check the intersected feature set
if (cabsInt == null || Count(cabsInt) == 0) {
return {"errorMessage": "Please edit inside a cabinet boundary"}
}
// filter cabsInt for your flagged polygon
var sdy_hut = First(Filter(cabsInt, "cab_id = 'SDY-HUT'"))
if (sdy_hut == null) {
return false
}
return true
You can continue using first but first (no pun) you have to add an additional filter against the polygon you want. Push the query all the way to the DB.
var cabs = FeatureSetByName($datastore, "Proposed_OLT_LCP_Boundaries_copy", ["cab_id"], false)
var filteredCabs = filter(cabs, "cab_id='SDY-HUT'")
var cabsInt = Intersects(filteredCabs , $feature)
var cabSpliceInt = First(cabsInt)
if (cabSpliceInt == null) return {"errorMessage": "Please edit inside a cabinet boundary"}
return true;
Okay great, this makes sense. What is the syntax for using a list in this case? What is the Arcade equivalent of "IN"? I want to do something like the following -
var filteredCabs = filter(cabs, "cab_id IN ('SDY-HUT', 'ESC-C02', 'ESC-C04')")
That statement is correct and should work
p.s. it is not Arcade, it is SQL.