Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Defining parameters in a Python toolbox for "FieldMapping"

$
0
0
How do you add FieldMapping to a Python toolbox?

Here is the webpage for Defining parameters in a Python toolbox.
--- Defining parameters in a Python toolbox ---
http://resources.arcgis.com/en/help/...0000028000000/

Below is how ESRI has documented the parameter for "GEFeatureLayer"
Note: I had to type this as "FeatureLayer" to make it work.

def getParameterInfo(self):
param0 = arcpy.Parameter(
displayName="Input Features",
name="in_features",
datatype="GPFeatureLayer",
parameterType="Required",
direction="Input")


Now I've tried using the same structure to create a parameter for "FieldMapping" which is documented on the following webpage:
---- "Defining parameter data types in a Python toolbox" ---
http://resources.arcgis.com/en/help/...0000035000000/

def getParameterInfo(self):
param0 = arcpy.Parameter(
displayName="Field Mapping",
name="in_mapping",
datatype="GPFieldMapping",
parameterType="Required",
direction="Input")

This just gives me a text box. I've also tried: "FieldMapping", "FieldMappings", and a few others. Nothing works.
Even if I have the correct datatype it's not clear how to assign the field mapping to the parameter.

fms = arcpy.FieldMappings()

I would think it should be something like the ValueList but I cannot find any documentation on this.

Viewing all articles
Browse latest Browse all 2485

Trending Articles