It appears that the Calculate Field tool when using the SQL expression type in ArcGIS Pro 2.3.1 does not honor a selection set. Is this functionality not supported or this a bug? I could not find any mention of this in the ArcGIS Pro help.
Solved! Go to Solution.
Best practice: try to not have duplicate layer names in a map (but I know there are reasons you might want that, so...)
This issue was discussed here: https://community.esri.com/message/833996-re-applying-field-calculator-only-on-selected-features?com...
With duplicate layer names, if you have a selection on the second layer, and if you've right-clicked the field header to open the Calculate Field tool, the tool gets populated with the first layer. As a user, you could switch it over to the second layer, but why would you - you instantiated the tool from the second layer, right?
Anyway, we have a fix for that in Pro 2.4. So until then, not having duplicate layer names will help avoid issues. I hope this helps!
After additional testing I have found that this issue also occurs when using the Python 3 expression type and leads me to believe this is a bug (and a significant one at that).
I'm using AGP 2.3.2 and tested this with Arcade and Python and it worked as expected. What was unexpected is that using SQL expressions on a file geodatabase feature class threw "ERROR 002536: Table <FC> does not support or is in a state to support SQL expressions." Querying this error, the Help page said SQL expressions are only supported on feature service and enterprise geodatabase data. That's a significant change to me!
Robert, it's documented that SQL expression type is only for
https://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field.htm
Kyle Balke, GISP it would be important to provide steps, more details, and screenshots to understand what you're seeing especially since Robert says he tried with Arcade and Python and it works as expected.
You don't have layers with the same name in a map do you?
Very true Kory - saw that after the ERROR message was thrown. Used to my ArcMap days of SQL expressions is all - AGP is a different application as we know. Thx!
I am performing the Field Calculation against a hosted feature service (hence using the SQL expression type). When I select one or more records and perform the calculation it updates all records in the table not just the selected records. I just added the hosted feature layer to a new map in Pro and the selection set was honored. Odd issue indeed...seems as though the layer in the map had an issue/corruption?
Kory I did have two layers with the same name in the map. Once I removed one of the layers the selection set was honored!
Thanks
Best practice: try to not have duplicate layer names in a map (but I know there are reasons you might want that, so...)
This issue was discussed here: https://community.esri.com/message/833996-re-applying-field-calculator-only-on-selected-features?com...
With duplicate layer names, if you have a selection on the second layer, and if you've right-clicked the field header to open the Calculate Field tool, the tool gets populated with the first layer. As a user, you could switch it over to the second layer, but why would you - you instantiated the tool from the second layer, right?
Anyway, we have a fix for that in Pro 2.4. So until then, not having duplicate layer names will help avoid issues. I hope this helps!
This complete makes sense and really was laziness on my part. I truly appreciate the feedback!
Best,
Kyle
I'm glad that helped, Kyle. If you think it was the correct answer, could you please mark it to keep this thread clean?
Thank you.