1

I am using a python toolbox in ArcGIS 10.2.2 and want a drop down list of all the versions for the person reconciling to choose from. (And I do not want to include dbo.DEFAULT and DS.Draft). But this list is populated right after a script is run to create the editor's version and if the Python Toolbox isn't refreshed manually in ArcMap, then this newest version doesn't show up in the list.

I looked at updateParameters, but either I was writing it incorrectly or it doesn't work because the user isn't actually changing a parameter that triggers it.

Regardless, I want to refresh the list at the time the script is run.

Can I use updateParameters or do a reload or something else snazzy that will make the list repopulate?

The other thing is I could switch the order of the parameters and having the user type their initials first which would then be a user action that could trigger the updateParmaters, but not sure this is the issue and seems convoluted.

import sys, arcpy, os
class Toolbox(object):
 def __init__(self):
 """Define the toolbox (the name of the toolbox is the name of the
 .pyt file)."""
 self.label = "EGDB Data Steward Version"
 self.alias = ""
 # List of tool classes associated with this toolbox
 self.tools = [Prep]
class Prep(object):
 def __init__(self):
 """Define the tool (tool name is the name of the class)."""
 self.label = "Prepare for Reconcile and Post"
 self.description = "Create grandfather version of editor for DS"
 self.canRunInBackground = False
 def getParameterInfo(self):
 #Define parameter definitions
 params = [] 
 # First parameter
 param0 = arcpy.Parameter(
 displayName="Editor's Version Name",
 name="editor_full_versionname",
 datatype="GPString",
 parameterType="Required",
 direction="Input")
 param0.filter.type = "ValueList"
 param0.filter.list = [v.name for v in arcpy.da.ListVersions(r"\\inpyosegis05\DatabaseConnectionFiles\DataStewardsOnly\YOSEGIS_VectorYOSE_DS.sde")
 if v.name not in ["dbo.DEFAULT", "DS.Draft"]] #Take DEFAULT and Draft off the drop-down list as choices.
 # Second parameter
 param1 = arcpy.Parameter(
 displayName="Data Steward's Initials",
 name="DS_initials",
 datatype="GPString",
 parameterType="Required",
 direction="Input")
 params = [param0, param1]
 return params
def isLicensed(self):
 """Set whether tool is licensed to execute."""
 return True
def updateParameters(self, parameters):
 """Modify the values and properties of parameters before internal
 validation is performed. This method is called whenever a parameter
 has been changed."""
 param0 = arcpy.Parameter(
 displayName="Editor's Version Name",
 name="editor_full_versionname",
 datatype="GPString",
 parameterType="Required",
 direction="Input")
 param0.filter.type = "ValueList"
 param0.filter.list = [v.name for v in arcpy.da.ListVersions(r"\\inpyosegis05\DatabaseConnectionFiles\DataStewardsOnly\YOSEGIS_VectorYOSE_DS.sde")
 if v.name not in ["dbo.DEFAULT", "DS.Draft"]] #Take DEFAULT and Draft off the drop-down list as choices.
 return 
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Mar 4, 2015 at 18:39

1 Answer 1

2

Try the following:

def updateParameters(self, parameters):
 if parameters[0].value:
 parmeters[0].filter.list = [v.name for v in arcpy.da.ListVersions(r"\\inpyosegis05\DatabaseConnectionFiles\DataStewardsOnly\YOSEGIS_VectorYOSE_DS.sde") 
 if v.name not in ["dbo.DEFAULT", "DS.Draft"]]
 return
answered Mar 4, 2015 at 20:33
1
  • Hi Barbarossa, thank you but that didn't work either. Any other ideas? Commented Mar 4, 2015 at 23:32

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.