AnsweredAssumed Answered

I'm trying to create a distinct list of values in my Python Addin combo box drop down list

Question asked by GISGURU_001 on Jul 13, 2016
Latest reply on Jul 13, 2016 by GISGURU_001

I'm trying to create a distinct list of values in my Python addin combo box drop down list; i already have the script that actually shows all the values of the field appended to my combo box drop down. What i intend to achieve with this is to have a list of distinct values on my drop down - see my code below;

 

def __init__(self):
        OBJECTID = []
        for row in arcpy.SearchCursor("BldForm"):
            OBJECTID.append(row.Combo)
        self.items = sorted(OBJECTID)
        self.editable = True
        self.enabled = True
        self.dropdownWidth = 'WWWWWWWWWWWW'
        self.width = 'WWWWWWWWWWWW'
   
    def onSelChange(self, selection):
        
        mxd = arcpy.mapping.MapDocument("Current")

        for df in arcpy.mapping.ListDataFrames(mxd):
            if df.name == "Layers":
                dfmain = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]


        OBJECTID = []
        for row in arcpy.SearchCursor("BldForm"):
            OBJECTID.append(row.Combo)

 

I'll kindly appreciate your help on this.

Outcomes