Export Report To PDF can't be published as GP if expression parameter is used

581
1
Jump to solution
07-14-2022 12:10 AM
MatthiasKl
New Contributor III

I've created a Python Toolbox which makes use of the fairly new reporting tool arcpy.management.ExportReportToPDF()

So the execute part of my toolbox basically looks like this:

 

 

 

arcpy.management.ExportReportToPDF(
    in_report = reportfile,
    out_pdf_file = outputpath,
    expression = filterexpression,
    resolution = 150,
    image_quality = "BETTER",
    embed_font = "EMBED_FONTS",
    compress_vector_graphics = "COMPRESS_GRAPHICS",
    image_compression = "ADAPTIVE",
    password_protect = "NO_PASSWORD_PROTECT",
    pdf_password = None,
    page_range_type = "ALL",
    custom_page_range = "",
    initial_page_number = None,
    final_page_number = None
)

 

 

 

The variables reportfile, outputpath and filter expression are provided by the user. The tool works as expected in ArcGIS Pro 2.9.3, but can't be published as a Geoprocessing Service (we are using ArcGIS Server Version 10.9.1. Our production environment is still on 10.6.1 and here, it does not work at all which seems logically given the fact that this function was introduced with ArcGIS Pro 2.8). After some debugging I figured out that if I leave out the expression parameter, the tool can be published and works just fine. The Datasource for my *.rptx reportfile is a query layer. Could this be the problem? But then I wonder why it works locally. The ErrorMessage: ERROR 999999 is no big help.

My filter expression is quite simple:

 

 

 

filterexpression = f"controldate >= timestamp '{from}' AND controldate <= timestamp '{to}'"

 

 

 

 

0 Kudos
1 Solution

Accepted Solutions
MatthiasKl
New Contributor III

Using ArcGIS Pro 3.1.1 I was able to publish my Python Toolbox Tool. I suspect that my problem was related to BUG-000145220.

View solution in original post

0 Kudos
1 Reply
MatthiasKl
New Contributor III

Using ArcGIS Pro 3.1.1 I was able to publish my Python Toolbox Tool. I suspect that my problem was related to BUG-000145220.

0 Kudos