Could someone show me how to make something like this in a python toolbox as well as explain to me what is going on here?
I know that the user can select either a table or a feature class and this dialog box will create a list of the fields with check boxes. One question I have is when the user checks the fields and clicks OK, does it make a list of the checked fields or does it do something else?
The code below is a close as I've gotten to the above image, even though I know all it does it let you select a single field from the list of fields. Any help would be much appreciated. Thanks!
# Third parameter - User will select the parcel ID field parcelID = arcpy.Parameter( # Name that shows inside the tools dialog displayName = "Select the Paracel ID field", # This variable puts the displayName over the input name = "parcelID", # Accepts a field as input datatype = "Field", # Have to enter somthing before the tool can run parameterType = "Required", # It's an input to the tool direction = "Input") parcelID.parameterDependencies = [existingData.name]
Below an example of a list of field from a featureclass extracted from the Help (ArcGIS Help (10.2, 10.2.1, and 10.2.2) )
def getParameterInfo(self): param0 = arcpy.Parameter( displayName="Input Features", name="in_features", datatype="GPFeatureLayer", parameterType="Required", direction="Input") param1 = arcpy.Parameter( displayName="Field", name="field", datatype="Field", parameterType="Required", direction="Input") # Set the filter to accept only fields that are Short or Long type param1.filter.list = ['Short', 'Long'] param1.parameterDependencies = [param0.name]