Select to view content in your preferred language

Select by attributes returns a new layer instance

1573
4
Jump to solution
12-24-2021 08:33 AM
Labels (1)
ArthurKay
Occasional Contributor

I've run into this bug a few times over the years. Select by attributes on Feature will return Feature_layer1 with the selection on it. The original Feature layer will not have a selection. Has anyone else ran into this? In the past it sort of just went away on its own, but I've restarted, created a new project etc and it is still happening.


tags: SelectLayerByAttribute, bug, duplicates layer

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

forgot the link, so the tool is working as expected

Select Layer By Attribute (Data Management)—ArcGIS Pro | Documentation

If the input is a feature class or dataset path, this tool will automatically create and return a new layer with the result of the tool applied.


... sort of retired...

View solution in original post

4 Replies
DanPatterson
MVP Esteemed Contributor

location of the featureclass? (local, sde etc), version of Pro? no editing going on?

and are you using the tool?

Select Layer By Attribute (Data Management)—ArcGIS Pro | Documentation

or a shortcut


... sort of retired...
0 Kudos
ArthurKay
Occasional Contributor

Yeah I was using Select Layer By Attribute. The FC is in a GDB. I'm on 2.9 now but I also ran into a while ago probably around 2.5. I don't think it was due to editing as I had restarted the application and the computer. Perhaps it is partly from having ArcCatalog open simultaneously though. My work around was just to generally avoid using Select Layer By Attribute. Many gp tools allow the "where_clause" that removes the need to use select layer by attribute.  It was also affecting my trace network output--I had been copying the selection result of a trace and with this bug it would copy the entire network. But now I learned of the "Trace_Results_Aggregated_Lines" parameter so that fixed it. Since it persisted after restarting, another thought is it has to do with the code. Maybe the behavior can change if you call for the FC from its full directory (thus creating another layer instance?) or as its name alias from the map contents (thus referencing your current layer).  

0 Kudos
DanPatterson
MVP Esteemed Contributor

forgot the link, so the tool is working as expected

Select Layer By Attribute (Data Management)—ArcGIS Pro | Documentation

If the input is a feature class or dataset path, this tool will automatically create and return a new layer with the result of the tool applied.


... sort of retired...
DanPatterson
MVP Esteemed Contributor

Maybe the behavior can change if you call for the FC from its full directory (thus creating another layer instance?)

If you get the FC from full path, it does make a featurelayer to work with, probably why you saw the ...._1 in the name since another layer of the name existed.


... sort of retired...
0 Kudos