I am currently working on a script that reads the number of features selected in a layer and returns a message or does a function based on how many records are selected.
If 0 are selected: it tells the user to "make a selection"
If >10, it tells users "too many features selected, must be less than 10"
If they select between 1-10 features, it runs the rest of the function.
I have the following logic:
features = int(arcpy.GetCount_management (featureLayer).getOutput(0))
The issue with this logic is that if no features are selected (if features<1:) it reads it as the count of the entire feature class and so returns msg2.
I tried instead to use the logic of
desc = arcpy.Describe (Featureclass)
if desc.FIDset ==' ':
This second logic works in ArcGIS desktop, but will not work in AGOL if I publish as a Geoprocessing service.
Can anyone think of any workarounds that will recognize if 0 records are selected?