Calling Queried Feature in Attribute Rules

100
2
Jump to solution
10-05-2022 09:05 PM
Labels (2)
AshleyMcKay
New Contributor

I am using ArcGIS Pro 2.8 to build an attribute rule for a point feature that will count the lines of another feature class intersecting each point. Seems easy enough but I need it to count only certain lines. We have a model to do this in post processing but I would like to move this to our live data editing. 

I can get a valid expression for counting intersecting lines until I try and add the query. Is there a way to call only the lines of my feature that match certain attribute. Sample of one of my failed attempts below. 

var cable = FeatureSetByName ($datastore, "CableDD", ["Cable_Category"], 'Drop')
var intersectLayer = Intersects(cable, $feature)
var cnt = Count(intersectLayer)
if (cnt > 0) {
return cnt
} else {
return "error"
}

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Regular Contributor

In the FeatureSetByName() function, the "drop" is in the wrong place. Is this a field or is this the value of Cable_Category you want to count?

Also, trying to return "error" (a string) for an integer field will give you an error. If your field is a string field, it will work, though.

if you want to reject the edit when there are no intersecting lines, you can return a dictionary with the key errorMessage.

 

So, assuming "Drop" is the value you want to filter and you want to reject the edit if the point doesn't intersect any lines:

var cable = FeatureSetByName ($datastore, "CableDD", ["Cable_Category"], true)
var cableDrop = Filer(cable, "Cable_Category = 'Drop'")
var intersectLayer = Intersects(cableDrop, $feature)
var cnt = Count(intersectLayer)
if (cnt > 0) {
    return cnt
}
return {"errorMessage": "No intersecting lines"}

 


Have a great day!
Johannes

View solution in original post

0 Kudos
2 Replies
JohannesLindner
MVP Regular Contributor

In the FeatureSetByName() function, the "drop" is in the wrong place. Is this a field or is this the value of Cable_Category you want to count?

Also, trying to return "error" (a string) for an integer field will give you an error. If your field is a string field, it will work, though.

if you want to reject the edit when there are no intersecting lines, you can return a dictionary with the key errorMessage.

 

So, assuming "Drop" is the value you want to filter and you want to reject the edit if the point doesn't intersect any lines:

var cable = FeatureSetByName ($datastore, "CableDD", ["Cable_Category"], true)
var cableDrop = Filer(cable, "Cable_Category = 'Drop'")
var intersectLayer = Intersects(cableDrop, $feature)
var cnt = Count(intersectLayer)
if (cnt > 0) {
    return cnt
}
return {"errorMessage": "No intersecting lines"}

 


Have a great day!
Johannes
0 Kudos
AshleyMcKay
New Contributor

Thank you! This worked. 

var cable = FeatureSetByName ($datastore,"Clearwave_KS.GISOWNER.Fiber_Cable_LLD", ["Cable_Category"], true)
var cableDrop = Filter(cable, "Cable_Category = 'Drop'")
var intersectLayer = Intersects(cableDrop, $feature)
var cnt = Count(intersectLayer)
return cnt

0 Kudos