AnsweredAssumed Answered

Using Update Parameters in Python Toolbox to Get list of Feature Classes in SDE

Question asked by matthewrusso on Dec 29, 2015
Latest reply on Sep 11, 2017 by alexperez

Hi all,


I have a tool that basically push's data down from one environment to another.  An example of this is from production to test environment.


Currently the tool has the import feature classes hard coded into it.  What I am trying to do is generate a Dynamic list when the first parameter is selected (a database connection file)


Anyone have any advice for me that would be great! Below is the code i currently have that does not work.


def getParameterInfo(self):

     from_database = arcpy.Parameter(
          displayName = "From Database",
          name = "from_database",
          datatype = "GPString",
          parameterType = "Required",
          direction = "Input")

     from_database.filter.type = "ValueList"
     from_database.filter.list = [, self.test]

     to_database = arcpy.Parameter(
          displayName = "To Database",
          name = "to_database",
          datatype = "GPString",
          parameterType = "Required",
          direction = "Input")

     to_database.filter.type = "ValueList"
     to_database.filter.list = [self.test,]

     select_features = arcpy.Parameter(
          displayName = "Select Features to Push Down",
          name = "down_features",
          datatype = "DEFeatureClass",
          parameterType = "Required",
          direction = "Input"
          multiValue = True)

     parameters = [from_database, to_database, select_features]

     return parameters

def updateParameters(self, parameters):

     if parameters[0].value:
          arcpy.env.workspace = parameters[0].valueAsText

          fcs = arcpy.ListFeatureClasses()
          parameters[3].filter.list = fcs




So what i want is to get a check box list of all the feature classes in the "from_database" parameter where the user can check the feature classes they want to send from production to test.... basically to update our environments.


Let me know thanks everyone!




below is my values for the database connections = r'\\hqstore\geostore\Software\Scripts\Python_Toolbox\ConnectionFiles\PRODUCTION_10.2.2_GISUser_Default.sde'
self.test = r'\\hqstore\geostore\Software\Scripts\Python_Toolbox\ConnectionFiles\Test_10.2.2_GISUser_Default.sde' = r'\\hqstore\geostore\Software\Scripts\Python_Toolbox\ConnectionFiles\Dev_10.2.2_GISUser_Default.sde'