Select to view content in your preferred language

Getting out of range error on Update Template Survey123

359
1
01-04-2024 08:58 AM
yasir_khaan
New Contributor
Hi There,
I am using a function which will check if there is a template already with same name, update it or else upload it.
I first upload this template and when I re-upload it, it showed an error which was understandable that template already exists.
But when I use this update_report_template function, I provide it with filename, and tried different ways but it always throws me this error.
 
Code and error provided below
 
gis = GIS(AGOL_ORG_URL, AGOL_USERNAME, AGOL_PASSWORD)
survey_manager = arcgis.apps.survey123.SurveyManager(gis)
survey_by_id = survey_manager.get(survey_id)
template_file = "Template v6.docx"
update = survey_by_id.update_report_template(template_file)
 
Getting this error:
update = template_item[0].update(item_properties={}, data=template_file)
IndexError: list index out of range
0 Kudos
1 Reply
ZacharySutherby
Esri Regular Contributor

Hello @yasir_khaan

Is the name of the item in your ArcGIS content "Template v6"? The name of the template used in the update_report_template() method will need to match the name of the item in your content. 

Thank you,
Zach
0 Kudos