Using UniqueValuesSymbology Class at 10.1

Discussion created by BrokenLegMike on Jun 13, 2012
Latest reply on Aug 12, 2013 by jbarrette-esristaff

I am playing around with the UniqueValuesSymbology class introduced at 10.1. It looks like the properties of the layer symbology is passed into python lists (i.e. classValues, classLabels)

I edited the script example from the help menu to update the classValues based on a list built from values in a field ('SMU') in a feature class. This works fine.

What I am struggling with is, after the class Values are updated, I want hard code the matching classLabels (or use a look up table) to update the label based on values in the classValue. So just an if statement to say something like.

  if lyr.symbology.classValues == "M1":
      lyr.symbology.classLabels = "Test"

I understand why this kind of is statement isn't working because the properties are python lists. So, I'm thinking I need to build 2 lists, one for the classValues and then one for the classLabels, but I'm just not sure how to go about it. Here's is my code:

import arcpy
mxd = arcpy.mapping.MapDocument(r"Z:\Test.mxd")
lyr = arcpy.mapping.ListLayers(mxd, "Soil Map Units_temp")[0]

smuList = []
rows = arcpy.da.SearchCursor(lyr, ["SMU"])
for row in rows:

if lyr.symbologyType == "UNIQUE_VALUES":
  lyr.symbology.classValues = smuList
  lyr.symbology.showOtherValues = False

# this is my pseudo code. In essence, this is what I want to do. Update the classLabel based on the values from classValues
  if lyr.symbology.classValues == "M1":
      lyr.symbology.classLabels = "Test"

Any suggestions are welcome.