I have been trying to get this to work for awhile, and sometimes I notice that the reports get generated and are in the temp folder on my C drive within a zip when I use "1=1", however when I try to use a where statement "created_date >= CURRENT_TIMESTAMP - INTERVAL '100' DAY", it completes but does not create any reports. any ideas?
from arcgis.gis import GIS
import os
from zipfile import ZipFile
from arcgis.apps.survey123._survey import SurveyManager, Survey
gis = GIS("portal url","un","pw") #fill in 3 strings here
survey_mgr = SurveyManager(gis)
survey = survey_mgr.get("32a7416f7af14d8db2b20f19ca95be5b") #fill in 1 string here
print(survey.report_templates) #see all available print templates for this survey
surveytemplate = survey.report_templates[0]
print(surveytemplate)
reportTitle = "str=${lineid}_TEFIS_${tefis}_StrNo_${strno}"
whereQuery = "created_date >= CURRENT_TIMESTAMP - INTERVAL '100' DAY"
output_format = '{"output_format":"str=pdf"}'
print(whereQuery)
try:
print('Trying to generate...')
survey.generate_report(surveytemplate, "created_date >= CURRENT_TIMESTAMP - INTERVAL '100' DAY")
print(survey.reports)
print('Finished')
except Exception as e:
print(e)