I am trying to create a Value Table I will use to create a field mapping object. First column will represent the target field, second column carries the source field. The first column is populated using the values property, so all fields from param0 are listed. I want the second column to offer a list of source fields from param2 to choose from. I am able to see this list, but when I go to choose the matching field, I get:
The value is not a member of x. ERROR 000800: The value is not a member of CENTERLINEID | FROMLEFT | TOLEFT | FROMRIGHT | TORIGHT | FULLNAME |... etc.
Here is my code:
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter('target_rcl', 'Target road centerline', 'Input', 'DEFeatureClass', 'Required')
param0.filter.list = ["Polyline"]
param1 = arcpy.Parameter('target_ap', 'Target address points', 'Input', 'DEFeatureClass', 'Required')
param1.filter.list = ["Point"]
param2 = arcpy.Parameter('rcl', 'Road centerline', 'Input', 'DEFeatureClass', 'Required')
param2.filter.list = ["Polyline"]
param3 = arcpy.Parameter('ap', 'Address points', 'Input', 'DEFeatureClass', 'Required')
param3.filter.list = ["Point"]
param4 = arcpy.Parameter('vt_rclfieldmap', 'Field mapping for RCL', 'Input', 'GPValueTable', 'Required')
param4.columns = [['String', 'Target Field'], ['String', 'Source Field']]
param4.filters[0].type = 'ValueList'
param4.filters[0].list = ['x']
param4.filters[1].type = 'ValueList'
param4.filters[1].list = ['X']
params = [param0, param1, param2, param3, param4]
return params
def updateParameters(self, params):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
if params[0].value:
flds = [f for f in arcpy.Describe(str(params[0].value)).fields if
f.type not in ('OID', 'Geometry')]
vallist = []
for fld in flds:
vallist.append([fld.name, ' '])
params[4].values = vallist
if params[2].value:
srcflds = [sf.name for sf in arcpy.Describe(str(params[2].value)).fields if
sf.type not in ('OID', 'Geometry')]
params[4].filters[1].list = srcflds
return
Here is an image that will hopefully demonstrate my goal... I feel like I'm close, just missing how to parse that a single value from the list of source fields is the desired input (edit) I believe the pyt takes my filter on the second column and applies it to the first, resulting in the error of 'value not found in list'. Not sure why it would disregard the index, but that seems to be the case.