2

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.

enter image description here

3
  • Check out this help link - pro.arcgis.com/en/pro-app/arcpy/classes/parameter.htm
    – enolan
    Jan 7, 2020 at 19:18
  • It maybe that you have 'ValueList' and it looks that it should be 'ValueTable'.
    – enolan
    Jan 7, 2020 at 19:27
  • @enolan no dice. Have a slight fix, just using a drop down list for both columns, generated from the two different inputs. Would still value having the first column autopopulated, but that may be a task for another day. The issue, I have discovered, is related to afilter on that whole value table. It is not happy that the values in the first column are not matching those in the second...which is the whole point.
    – digiHUC
    Jan 7, 2020 at 20:27

1 Answer 1

1

These like makes x or X the only allowable value:

param4.filters[0].list = ['x']

param4.filters[1].list = ['X']

Remove these lines.

1
  • Those just act as place holders until the updateParameters function is checked. I removed them to test, did not make a difference in functionality.
    – digiHUC
    Jan 24, 2020 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.