I am creating a python tool which looks like the figure below.
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
param2.parameterDependencies = [param1.name]
. But it sounds like you want the user to add a table into the Value Table as a "Lookup Table", and then choose a field from that? Is that what you mean?Field
column of your value table based on theLookup Table
value in that same row in a PYT. You might be able to customize this in .NET, but I'm not sure. It would be awesome though if Esri implemented an advanced filter option where you could dynamically change filters in each row of the Value Table.Fields
as the first column in the Value Table. Se my answer below.