I have created a custom geoprocessing script tool which contains an optional FeatureSet parameter.

When unpacking the parameters in the script, the FeatureSet is defined as a RecordSet object, even though no input was received. It seems to set a default value if it was not entered.

I need to check if this parameter was specified by the user or not.

For example, when I run this through ArcMap without a FeatureSet parameter the following occurs:

exportAOI = arcpy.GetParameter(3)
arcpy.AddMessage('AOI is: ' + str(exportAOI))
# AOI is: <geoprocessing record set object object at 0x14133578>

I was expecting exportAOI to be None.

How can I determine whether the user actually set this type of parameter?

  • Not played with FeatureSets much, but try checking its JSON property length or contents (e.g. compare an empty vs. a populated feature set): resources.arcgis.com/en/help/main/10.1/index.html#//…
    – blah238
    Jul 17, 2014 at 18:22
  • 1
    What if you use GetParameterAsText()? I use that for optional parameters and I just check with a simple if not exportAOI:
    – Paul
    Jul 17, 2014 at 18:25
  • @Paul I am not sure but I believe you actually have to use GetParameter with Feature/RecordSet objects. I am not sure if they have a textual representation (other than JSON). At least the documentation does not mention using GetParameterAsText: resources.arcgis.com/en/help/main/10.1/index.html#//…
    – blah238
    Jul 17, 2014 at 18:34
  • I had thought about using the GetParamterAsText(), but it felt a bit hacky. I was hoping ESRI had a simple way of going about this, but I think the GetParameterAsText() is my best option at this point.
    – jmfolds
    Jul 17, 2014 at 18:44
  • 1
    @JeremyFolds, I feel the same way about GetParameterAsText() feeling hacky, but it seems to be the Esri way of doing things. I have talked to Esri a couple of times and they always point me to using GetParameterAsText() over GetParameter().
    – pgreen2
    Jul 19, 2014 at 3:02

2 Answers 2


So, many thanks to all who commented on this. I will go ahead and answer this based on the discussion from those comments and my personal experience.

As mentioned by @blah238 and @Branco, there is a JSON property on a featureSet that can be checked, however, when running the script from within ArcMap and using a featureClass as input, checking for that property produced an error for me.

In my case, the script is being called from a GP service with a JSON FeatureSet as input, so checking against the JSON property should work, although I opted to use GetParameterAsText() since it should work no matter how the script is used.

In summary:

Checking if an optional featureSet parameter was actually passed in can easily be achieved by checking the existence of GetParameterAsText() rather than checking the existence of GetParameter(). Furthermore, depending on the situation, checking against the JSON property on a featureSet also works.

Thanks again to all participants!



Use the arcpy.Describe method on the featureset parameter and get the file property.

import arcpy

notRequiredFeatureSet = arcpy.GetParameter(0)
arcpy.AddMessage('AOI is: ' + arcpy.Describe(notRequiredFeatureSet).file)

if a Feature set was added:

    Executing: Script "C:\Program Files\ArcGIS\Desktop10.2\ArcGlobeData\continent.shp"
    Start Time: Wed Jul 23 14:57:20 2014
    Running script Script...
    AOI is: continent.shp
    Completed script Script...
    Succeeded at Wed Jul 23 14:57:20 2014 (Elapsed Time: 0.01 seconds)

If no feature set added:

     Executing: Script #
     Start Time: Wed Jul 23 14:54:25 2014
     Running script Script...
     AOI is: 
     Completed script Script...
     Succeeded at Wed Jul 23 14:54:25 2014 (Elapsed Time: 0.00 seconds)

EDIT to address Paul:

import arcpy

notRequiredFeatureSet = arcpy.GetParameter(0)
if not arcpy.Describe(notRequiredFeatureSet).file:
    arcpy.AddMessage("No Input Received")
    arcpy.AddMessage('AOI is: ' + arcpy.Describe(notRequiredFeatureSet).file)
  • How does if not AOI turn out I wonder?
    – Paul
    Jul 23, 2014 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.