AnsweredAssumed Answered

Python script Tool Multi-Value parameter re-ordering buttons

Question asked by thammer@openspace.org on Mar 14, 2019
Latest reply on Mar 18, 2019 by rvburton

Hi-

I'm trying to set the values of one control (Multi-value, data type: string <via checkboxes>) to another parameter control (Multi-value, data type: "any value" which produces a drop down with grid for items entered or selected with the add, delete, and re-ordering (up/down) buttons).

 

The goal is to use the reorder buttons on the 2nd control (of the auto-populated items) to reorganize the list by moving rows up and down, then taking the values out (as text type is fine) and processing them further.

 

The issue is that I can get the items to populate into the 2nd control (via the ToolValidator class, updateParameters method) but I can't change their order.  If I use the text entry box to populate the grid, it will allow me to change the order of the items.  

 

Here's the updated code snip:

  def __init__(self):
    """Setup arcpy and the list of tool parameters."""
    self.params = arcpy.GetParameterInfo()
    global PriorParam
    PriorParam = ""
 
  def initializeParameters(self):
    """Refine the properties of a tool's parameters.  This method is
    called when the tool is opened."""
    global PriorParam
    PriorParam = ""
    return

  def updateParameters(self):
     global PriorParam, selected_items_list
     if self.params[2].value:
         domains = arcpy.da.ListDomains(self.params[2].value)
         self.params[3].filter.list = [domain.name for domain in domains if domain.domainType == "CodedValue"]
     if self.params[3].value:
         domains = arcpy.da.ListDomains(self.params[2].value)
#Probably a more direct way to grab the actual domain object but this works for now.
         for domain in domains:
            if domain.name == self.params[3].value:
                coded_values = domain.codedValues
         self.params[5].filter.list = [val.encode('utf-8') for val,desc in coded_values.items()]
     if self.params[5].values  <> PriorParam:
        PriorParam = self.params[5].values
        IncomingParam = arcpy.GetParameterAsText(6)
        working_param = self.params[5].values
        self.params[6].values =  working_param # .params[5].values
     else:
        arcpy.AddMessage("Param5 didn't change after validate review.")
     return

 

Here's what the parameter page looks like:

 

Even though the Up/Down arrows are enabled, they don't actually re-order the items.  Am I using the wrong Data Type or is there some other storage location I should manually be moving the items from the "Code(s) to move"  to get them into the SequenceTheMoveCodes parameter control?

 

 

 

Please help!

 

Thanks!
Tad Hammer

Outcomes