This code I've created works for 1 (one) active layer and for 1 (one) field. I need to implement this code for many layers and fields in a open .mxd file.
I have 11 fields (years 2003 to 2015). I want to select some o of them (multivalue field) and after choose, generate the layers view to each field (year). I already did for 1 (one) field. But get stuck to many layers.
The shapefiles are from the same region/place so the best way to view is the layout view (create more than 1 data view)
The process is:
i. choose the table ii. choose the years (multivalue field) iii. generate N data views from the selected fields
import arcpy mxd = arcpy.mapping.MapDocument('CURRENT') df = arcpy.mapping.ListDataFrames(mxd, "") lyr = arcpy.mapping.ListLayers(mxd, "", df) lyrFile = arcpy.mapping.Layer(r"F:\PercACH.lyr") arcpy.mapping.UpdateLayer(df, lyr, lyrFile, True) Tabela = arcpy.GetParameterAsText(0) Campo = arcpy.GetParameterAsText(1) if lyr.symbologyType == "GRADUATED_COLORS": lyr.symbology.valueField = Campo arcpy.mapping.ExportToPDF(mxd, r"F:\TesteAgro.pdf") arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, lyrFile
What`s the best way to create many layers and data view for every year selected?