I am scripting a workflow in a .pyt. I am going to be merging multiple featureclass datasets and I would like to use the GPFieldMapping datatype to accept the fieldmappings from the user interface. I am struggling with the parameterDependencies part. Using the dependency it is only reading fields from the very first dataset in the param0 which is a multivalue parameter. How can I get the dependency to read from everything in the list not just the index object? Here is my sample code:
class Merge(object):
def __init__(self):
# Define the tool
self.label = "1 Merge Disparate Datasets"
self.description = "Merge disparate datasets."
self.canRunInBackground = False
self.category = "Tools"
return
def getParameterInfo(self):
# Define parameters
Param0 = arcpy.Parameter(
displayName = "Input Feature Classes:",
name = "MergeFeatures",
datatype = "DEFeatureClass",
parameterType = "Required",
direction = "input",
multiValue = True)
Param1 = arcpy.Parameter(
displayName = "Output Feature Class:",
name = "OutputFeature",
datatype = "DEFeatureClass",
parameterType = "Required",
direction = "output")
Param2 = arcpy.Parameter(
displayName = "Field Mappings:",
name = "FieldMap",
datatype = "GPFieldMapping",
parameterType = "Optional",
direction = "input")
Param2.parameterDependencies = [Param0.name]
params = [Param0, Param1, Param2]
return params
Specifically: Param0 is a multivalue input if datasets to be merged
Param2 is fieldmapping parameter. The parameterDependencies is set to the only thing that seems to work at work. But this = [Param0.name] only respects the dataset in the index position, and ignores the others. Show the Field Mapping widget on the user interface only shows fields from the first dataset dropped into the input.
Can I use a for loop inside of that []?
Thank you