AnsweredAssumed Answered

Export Report with Definition Query

Question asked by dkassing on Jun 27, 2016
Latest reply on Jun 28, 2016 by wwmiller68

Trying to export individual report for each row in a layer.  Seems the definition query piece is not working.  Any ideas?  Code is :

import arcpy, os

path = os.getcwd() 

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

lyr = arcpy.mapping.ListLayers(mxd, "BOB.TEST")[0]

fields = ['GLUE_ID']

with arcpy.da.SearchCursor(lyr, Fields) as cursor:

   for row in cursor:

        play = (row[0])

        arcpy.mapping.ExportReport(lyr,

                               r"C:\\Bob\\ExecutiveSummary.rlf",

                               r"C:\\Bob"+str(play)+".pdf",

                               "DEFINITION_QUERY",

                               report_definition_query="GLUE_ID="+str(play)+"")

del mxd

Outcomes