I'm trying to set the values of one control (Multi-value, data type: string ) 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 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.value: domains = arcpy.da.ListDomains(self.params.value) self.params.filter.list = [domain.name for domain in domains if domain.domainType == "CodedValue"] if self.params.value: domains = arcpy.da.ListDomains(self.params.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.value: coded_values = domain.codedValues self.params.filter.list = [val.encode('utf-8') for val,desc in coded_values.items()] if self.params.values <> PriorParam: PriorParam = self.params.values working_param = self.params.values self.params.values = working_param # .params.values else: arcpy.AddMessage("Param5 didn't change after validate review.") return
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?