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 returnYou 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).
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.