Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Creating a ValueTable with a column that has dependency

$
0
0

I am creating a python tool which looks like the figure below.

enter image description here

Input feature: It asks for a input feature class.
Valuetable(Lookup tables): It has two columns – one for look up tables and another for fields.

The fields in value table should have dependency on Input feature. is this possible ? How ?

Code:

 def getParameterInfo(self):
    param1 = arcpy.Parameter(
        displayName = "Input Feature",
        name = "in_features",
        datatype = "DEFeatureClass",
        parameterType = "Required",
        direction= "Input")
    param1.filter.list = ["Polyline"]

    param2 = arcpy.Parameter(
        displayName='Lookup tables',
        name='lookup',
        datatype='GPValueTable',
        parameterType='Required',
        direction='Input')

    param2.columns = [ ['DETable', 'LookupTable'], ['Field', 'Fields']]


    param2.filters[1].type="ValueList"  
    desc = arcpy.Describe(param1)  
    fields = desc.fields
    l=[]
    for f in fields:
        l.append(f.name)
    param2.filters[1].list = l

    param3 = arcpy.Parameter(
        displayName='Output',
        name='excel',
        datatype='DEFile',
        parameterType='Required',
        direction='Output')
    param3.filter.list = ['xls', 'xlsx']



    params = [param1, param2, param3]
    return params

Viewing all articles
Browse latest Browse all 767

Trending Articles