Combo Box : List unique values for a field (error)

03-17-2016 07:58 PM
New Contributor

I have built an Addin that has four combo boxes and a button.

combo box 1 provides a list of layers in the TOC (working)

combo box 2 takes user text input for a unique ID field (working)

combo box 3 provides a drop down with a list that displays all the fields in the selected layer (from combo box 1)

combo box 4 will provide a list of all the values for the selected field (from combo box 3)

Combo box 4 is broken, and when I click in the drop down window the python windows displays the following error:


AttributeError: value


The scripting is posted below. I can add the rest if needed. Thank you all very much for the assistance.

class ComboBoxClass3(object):

    """Implementation for SecureSurveyDefinitionQuery.toolbar_1 (ComboBox)"""

    def __init__(self):

        self.editable = True

        self.enabled = True

        self.dropdownWidth = 'WWWWWWWWWWWWWWWWWW'

        self.width = 'WWW'

        def onFocus(self, focused): 

            if focused:

                values = [row[0] for row in arcpy.da.SearchCursor(LayerName, attName)]

                uniqueValues = set(values)

                self.items = []

                for uniqueValue in uniqueValues:




    def onSelChange(self, selection):

            global SurveyCode

            val = (self.items, selection)[1]

            SurveyCode = str(val)             

            field = '"SURVEY_FILE_ID"'

            queryStr = str(field) + "= " + str(Survey_File_ID) + " AND " + '"' + str(attName) + '"' + " =" + "'" + str(SurveyCode) +  "'"

            mxd = arcpy.mapping.MapDocument("CURRENT")

            df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]

            for lyr in arcpy.mapping.ListLayers(mxd, LayerName, df):

                if lyr.supports("DEFINITIONQUERY"):

                    lyr.definitionQuery = queryStr


            del mxd

0 Kudos
0 Replies