Select to view content in your preferred language

ArcPy ExportReport Definition Query

02-05-2019 07:28 PM
New Contributor II

I wrote some code to run on my server that will automatically generate reports from a file geodatabase using several .rlf files that have definition queries within the .rlf files. The code runs flawlessly and now I'm trying to improve it by reducing the number of .rlf files I have to use by adding the definition queries to python within the ExportReport function. I'm having a heck of a time figuring out how to get this to work correctly. I have read over several posts from other users and came across this documentation Specifying a query in Python. This documentation is exactly what I'm trying to do however I can not figure out how to do it correctly. I would deeply appreciate it if someone could lend a hand and get this working for me so I can dissect it and play around some to understand the syntax.

SQL Expression:

Date > CURRENT_DATE-8 AND Area = 'Central'


arcpy.mapping.ExportReport(lyr, os.path.dirname(os.path.abspath(__file__)) + '\\' + 'Report_Templates' + '\\' 'Test_Report.rlf', r'D:\FTP Files\Reports\Test.pdf, DEFINITION_QUERY, report_definition_query= What do I add here?) ‍‍‍

0 Kudos
0 Replies