Hello,
Every week I'd like to automatically Open a survey on Sunday and Close it on Thursday. I know I can control the survey based on a specific Date range by interactively opening the Survey123 app but could I reset the Date range in the survey via Connect or a script or Model Builder?
Thanks,
GR
Hi @GregReinecke ,
In Survey123 Connect or Survey123 website, publishing a survey actually does two jobs: 1. update the .zip package for the form item, 2. create/maintain the behind feature layer. For your case, only updating the .zip package for the form item needs to be done.
To complete this, you can use Python script to:
1. Download the .zip package file of the form item at /data endpoint.
2. Update the .info file inside the package file.
2. Update the /data of the form item with the updated package file by using the /update item endpoint.
This should save you from publish the survey manually in Survey123 Connect.
The Survey123 Connect solution did the trick. I created some Python to run in the windows task scheduler to update the .info file every Sunday.
But now to complete the challenge I have to publish the survey so the changes to the .info file take effect. Can this be automated?
Thank you so much ZhifangWang!
Thank you. This is the kickstart I needed. Plenty of guidance on the web on how to implement your info. Looking forward to working through it. Thanks again ZhifangWang.
The open/closed setting is saved in the form.json file (settings.openStatusInfo) for a survey published from the Survey123 website or the <surveyName>.info file for a survey published from Survey123 Connect. Technically, you can use a script to update this setting in the file and then update the .zip file at the /data endpoint of the form item.
If your survey was published in Survey123 Connect, another workaround might be utilizing the `format-date(${date1}, '%a')` function to get the day of today. Then set corresponding questions to be always invalid and required or hidden to achieve the goal.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.