Select to view content in your preferred language

survey123 generate_report api works very intermittenly

191
3
a week ago
Carrie2025
Emerging Contributor

Hello everyone - I had a working script to generate reports on demand in survey123.

But it stopped working.  So I went back to basics, started new, followed the example data...  And I keep getting "none" as a response.  Except once in awhile- it actually outputs something.

I removed Identifying Items in the code below - to see the output, look at the attachments.

It runs fine if I manually trigger it from Survey123

and in my screengrabs, I know the output path is formatted wrong - It will get fixed once it runs as it should. 

This is my Initial notebook cell:

import arcgis
import arcgis.apps.survey123

from arcgis.gis import GIS
from arcgis.apps.survey123 import SurveyManager

gis = GIS("home")
survey_manager = SurveyManager(gis)

print (survey_manager)

________________________________

This is my second notebook cell

survey_id = 'IDnumber'

report_template = gis.content.get('IDnumber')
survey_item = gis.content.get(survey_id)

svy_obj = survey_manager.get(survey_id)

print(report_template)
print(survey_item)
print (svy_obj)

report_file = svy_obj.generate_report(report_template=report_template,
report_title="LessThan20_Report",
output_format="docx",
save_folder=r"downloadpath")

print (report_file)

_______________________

 

 

0 Kudos
3 Replies
ZhifangWang
Esri Regular Contributor

Hi @Carrie2025 ,

Does your report template use any web map that contains any invisible layer? 

We've identified an issue that if there is any invisible layer in the web map, printing a report using the web app will trigger the error "The layer <layerName> did not draw completely". This was introduced in the Survey123 November 2025 update on 11/13. We have applied a fix to the Survey123 website earlier today to address this issue.

If you still encouter any issue when printing a report, can you please try tht same template and data in the Survey123 website Data tab UI and share with us the error message and screenshot?

0 Kudos
Carrie2025
Emerging Contributor

No, it doesn't, it did initially, but I kept making the code simpler and simpler, finally creating a new, simple survey online, than using an autogenerated template.   I put in a support ticket yesterday - its very weird.

Thank you much!

Oh - and It runs fine when I run it from survey123 - no errors, downloads correctly.

0 Kudos
ZacharySutherby
Esri Regular Contributor

Hey @Carrie2025

Try running your notebook using the latest 2.4.2 version of the ArcGIS API for Python. This was logged as BUG-000179345. It looks like you're running your notebook in a hosted notebook, unfortunately the current runtime version for hosted notebooks uses Python API 2.4.1. At this time to test in 2.4.2 you would need to download the notebook and run in ArcGIS Pro 3.6 or a standalone Python environment. 

Thank you,
Zach
0 Kudos