This is my first post on this site.
I am using ArcGIS 10.2 for Desktop.
I wrote a simple script in the form of a python toolbox to calculate the speed of travel between consecutive entries of a point shapefile. The script works perfectly on single files. However, as soon as I try to run it as a batch, I get an error:
Error 000308: Invalid Field Type.
EDIT: By running in batch, I mean I am right-clicking on the tool in ArcMap and selecting “batch”, and then loading in several shapefiles at once.
I suspect that the error comes from something about how I defined the parameters:
inFileParam = arcpy.Parameter(
displayName="Input Feature",
name="in_feature",
datatype="GPFeatureLayer",
parameterType="Required",
direction="Input",
)
indivName = arcpy.Parameter(
displayName="indivName",
name="indivName",
datatype="Field",
parameterType="Required",
direction="Input",
)
indivName.parameterDependencies = [inFileParam.name]
indivName.filter.list = ["Text"]
dateField = arcpy.Parameter(
displayName="dateField",
name="dateField",
datatype="Field",
parameterType="Required",
direction="Input",
)
dateField.parameterDependencies = [inFileParam.name]
dateField.filter.list = ["Date"]
The indivName
and dateField
parameters are what gives the error when I click on the “check values” button in the batch window. Removing the filter seems to fix the error, but I would really like to have the filter. As I said above, it works just fine when I input them in a non-batch run of the tool. Also of note, this same problem has happened from pretty much every (but strangely not all) tools I have made.
As of now, my workaround is to modify the tool to explicitly code the field names when I need to do a batch run, but this is not ideal, since I am hoping to distribute this tool to other researchers.