Solved! Go to Solution.
def initializeParameters(self): arcpy.env.workspace = r"C:\temp\python\test.gdb" list = [] lstFCs = arcpy.ListFeatureClasses("*") for fc in lstFCs: list.append(fc) stringFilter = self.params[0].filter stringFilter.list = list return
def initializeParameters(self): arcpy.env.workspace = r"C:\temp\python\test.gdb" list = [] lstFCs = arcpy.ListFeatureClasses("*") for fc in lstFCs: list.append(fc) stringFilter = self.params[0].filter stringFilter.list = list return
Hi Andrew,
If you are using your script within a toolbox you can do this using the Tool Validation tab. You would set a parameter (i.e. Input) under the Parameters tab of the script's Properties. The Data Type for this parameter would be 'String'. You can then update the initializeParameters function with the following:def initializeParameters(self): arcpy.env.workspace = r"C:\temp\python\test.gdb" list = [] lstFCs = arcpy.ListFeatureClasses("*") for fc in lstFCs: list.append(fc) stringFilter = self.params[0].filter stringFilter.list = list return
You will want to change the 'arcpy.env.workspace' to your desired workspace. You will also need to update 'arcpy.ListFeatureClasses' if you are working with another data type (i.e. rasters, tables).