I have a toolbox that I turned into a GP tool. The users make a selection in a layer then the tool runs just on those records.
If I run the GP tool in a web app all works.
If I run the GP tool in Pro and give it a SDE layer it all works.
If I run the toolbox direct from the file system in Pro and give it a SDE or a web layer it all works.
But if I run the GP tool in Pro and give it a web layer (a ArcServer feature service) then it totally ignores the selection on the layer.
I found similar bugs but not this one.
Also a plug that the new Use selected features in the GP widget in WAB does not work either.
Thanks
There is a BUG-000144726 - The Make Layer tool does not honor feature selection in ArcGIS Pro that may/may not be related BUT it did provide some workarounds to test. For your web layer where feature selection is failing to be honored in the GP tool, try the following:
What is the result?
Not using the Make Layer tool at all so I am not sure that is it. That workaround would be too much for the novice users.
Thanks
This bug is marked as not to be addressed but it may be working now? First test failed but then I got it to go I think.
Sharing a workaround I'm using with a Python script until the bug is sorted out. The specific use case is I have involves two point layers and one parcel polygon layer and want to determine if the points both fall inside the parcel. Basically it's a test for collocation that uses the parcel boundary as a bounding area in case the points didn't both geocode exactly on top of each other.
Step 0: Add a field to the second point layer, will calculate at the end for points that collocated with the first point layer.
arcpy.management.AddField("POINT_LAYER_TWO", "MyCollocateField", "TEXT", field_length = 10)
#Step 1: Join the parcels to the first point, only keep parcels that intersected a point.
arcpy.analysis.SpatialJoin("PARCELS", "POINT_LAYER_ONE", "memory/Parcels_Join1", "JOIN_ONE_TO_ONE", "KEEP_COMMON")
#Step 2: Join the second point layer to the parcels that intersected the first point layer, keep all the points.
arcpy.analysis.SpatialJoin("POINT_LAYER_TWO", "memory/Parcels_Join_1", "memory/Parcels_Join_2", "JOIN_ONE_TO_ONE", "KEEP_ALL"
#Step 3: Calculate the collocate field based on the parcel ID field from the spatial join not being null, which will only be true for points that intersected a parcel from the spatial join with the first point layer.
arcpy.management.CalculateField("memory/Parcels_Join_2", "MyCollocateField", 'Iif(!IsEmpty($feature.PARCELID),"Yes","")', "ARCADE")
A hefty workaround to be totally honest, Select Layer by Location is so much nicer because it doesn't involve creating new datasets, but at least using the memory workspace prevents the script from creating any new intermediate data.