Create Report Print Service for multiple layers

758
3
Jump to solution
11-21-2022 02:00 PM
MaddieMooreDEQ
New Contributor II

Hello all,

I am in the process of building a print service for printing multiple different reports for different layers. This print widget is from a custom print service created in arcpro from the Export Web Map and Get Layout Templates Info Geoprocessing Services.

I mainly followed the example here: https://www.esri.com/arcgis-blog/products/arcgis-enterprise/mapping/print-reports-from-arcgis-enterp...

I have tweaked the example script to pull multiple reports from the layout folder location and reference the data layer for each particular report

MaddieMooreDEQ_0-1669067699337.png

The widget prints a majority of the reports based on the corresponding layer. However, one layer, randomly chosen by the widget, does not get it's report pulled and is instead placed in a duplicate report template of the one printed right before it.

 

See here:

MaddieMooreDEQ_1-1669067699116.png

 

If anyone has attempted this style of report before and/or has any tips or tricks on how to custom print, any help would be much appreciated!! 

 

Thanks!!

 

Update:

 

After further review it seems to be an issue occurring when the Report is exported to PDF. 

Here is where the report is exported to PDF and should be from the correct reportfn

MaddieMooreDEQ_0-1669213774919.png

Occasionally the output data is put into the report file from the report directly before it in the script

The Print JSON shows that the data from the layer is being pulled appropriately into the report but the wrong report is being pulled to fill from the export web map tool. 

0 Kudos
1 Solution

Accepted Solutions
MaddieMooreDEQ
New Contributor II

After further research here is the solution to this issue: 

It's possible the report list order changes when pulled into the temporary scratch project, so in order to ensure the correct report is grabbed include the Report name in r = p.listReports()[0]. So it would look like this: listReports("*REPORT NAME*")[0]

    listReports("*Report Name*")[0]

View solution in original post

0 Kudos
3 Replies
MaddieMooreDEQ
New Contributor II

After further research here is the solution to this issue: 

It's possible the report list order changes when pulled into the temporary scratch project, so in order to ensure the correct report is grabbed include the Report name in r = p.listReports()[0]. So it would look like this: listReports("*REPORT NAME*")[0]

    listReports("*Report Name*")[0]
0 Kudos
DHamiltonArlington
New Contributor II

Hello,

I am trying to do something very similar to you, but I only have one report, not multiple. I also followed the blog instructions that you did. My tool runs and spits out the map, but the report never shows up. I tried making the same changes to the code that you showed in your screen shot, but the report still does not show up. I was wondering if you ran into this issue at all while you were developing your tool and if so, what did you do to fix that?

Thanks!

0 Kudos
AlejandraMora_Rincón
New Contributor

Hi, 

I had this problem at the beginning. Please, when you create your report template, make sure that

Esri Template: Page per feature

Rows: Filter by expression (you don´t need to define an expression)

Also, when editing the script (ExportWebMap), make sure that the layer name you are typing is the alias name of the feature layer.

 

Finally, the name of your report must have the same name as your map template.

 

And in share web Tool : Synchronous

0 Kudos