0

Using ArcMap 10.4 and Python I am trying to run a code (arcpy.ExportReport) on a bunch of different frequency tables. Which I have completed the only problem is that if I have a table that does not match my definition query the code does not run and will not export the report.

Basically, how do I skip the code from running when the definition query parameters are not met.

Code Block:

            if:
               report_definition_query =SQL_NAME2arcpy.mapping.ExportReport(lyr,Template,PDF,"DEFINITION_QUERY",report_definitonn_query =SQL_NAME2)

           else:print "Blank Report"
1

This should be working just add NAME_OF_ERROR you receive (for ex. ValueError)

            try:
               report_definition_query =SQL_NAME2arcpy.mapping.ExportReport(lyr,Template,PDF,"DEFINITION_QUERY",report_definitonn_query =SQL_NAME2)

           except NAME_OF_ERROR:print "Blank Report"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.