I am following the method by @CuartaOportunidad_Local_IVC posted on the Updating the media folder of a Survey123 Form item blog.
see direct link here
shutil.make_archive(r'temp' + 'filename', 'zip', r'surveyfolder')
path = r'zippedsurvey'
surveyitemID = "itemid"
surveytoupdate = my_gis.content.get(surveyitemID)
surveytoupdate.update(data = path, item_properties={'type' : 'Form', 'title': 'filename', 'tags' : []})
thank you!
others have this issue
Survey123 Update Through Python - GeoNet, The Esri Community
Updating a Form using python - GeoNet, The Esri Community
Thanks Zach, I've tried removing from the Media folder and re-publishing, but still finding that the Linked Content CSV is not being respected and not being used for the choice list values. The Field App is working correctly actually, it's the Web Form that is not working right, it continues to reference the Media folder CSV and not use the Linked Content CSV.
Hello @MichaelBrown4,
If you use the script I had provided in the first comment on the post and only run the first 5 code cells (which will be up to and including the cell that extracts the zip file) in the unzipped folder that is created is the original CSV still in the media folder?
Thank you,
Zach
I am having the same issue as @MichaelBrown4 and @LeeIrminger1, where I can update the csv external file and the updates show up in the mobile app form, but the updated list doesn't show in the web form (just the list from the original publication). When I use your script to pull the survey design files, the updated files (including the media file) are saved from AGOL. I've tried clearing the caching in my browser and using a different browser completely and the old list still shows up in the web form.
My workflow requires using the web form, rather than the web app. Do you have any suggestions on how to solve this issue?
Was anyone else able to solve this problem?
For those having the same issue I was, I found that my issue wasn't with the first 5 code cells that Zach had shared in an earlier post, but it was in how I was updating the form on AGOL. I was zipping the entire folder for the form in My Survey Designs after updating the CSV file.
In looking at Zach's code, I realized that he was downloading the survey folder from AGOL and updating the CSV from the downloaded form, zipping and updating that folder. The downloaded form has fewer files, so I realized that maybe some of the files in the original form's folder in My Survey Designs were allowing the Survey on the mobile app to update the CSV data, but not letting the web form to update the CSV data. As soon as I followed Zach's code and updated the CSV in the media folder of the downloaded survey folder, both the web form and mobile form updated.
Thanks Zach!
Hey Zachary,
I was able to get the script to run however I ran into some odd behavior. I am using connect and the mobile application. The first time I ran the script without error it seemed to work as expected however after making additional changes to the update file the changes were not reflected in connect or the mobile application. Connect and the mobile application continue to return the value from the first time I ran the script despite the new values showing the csv file in the media folder. After reading through previous comments I realized I still had the survey linked to a copy of the csv file in AGOL. I removed the link and tried running the script again but now get this error:
What seems really strange to me is now that I have removed the link, connect and the mobile application continue to return the values from the first successful run even with those values being changed in the csv file in the media folder. Additionally, every time I open the form in connect I now get a message saying the XLS form has been modified asking if I want to update the survey even though no changes were made to the form. If I select yes it loads and then returns to the same box asking if I want to update the form in a loop until I select no.
Any help appreciated
Hello @ClintBoaz1,
The script is failing on passing along the size of the survey properties to the .update method. If you replace the surveyProp variable from the first parameter of the .update method and replace it with an empty dictionary {}. That should resolve the error message.
Thank you,
Zach
Hey Zachary,
That seems to have done the trick. Thanks again!
Hey Zach,
Thanks for pointing me in the right direction. I am trying to run the script in a Jupyter notebook but keep getting the following error message
Any help would be appreciated, Thanks!
Hello @ClintBoaz1,
In the path specified for the `download_folder` variable, if you navigate to that path is there a zip file with the same name as your survey in that location?
If not please double check the ID specified for the `itemID` variable is the item ID for your survey form item.
For example:
You can also insert print statements in code block 4 to print the `itm` and `savedZip` variables which will show what item in your Organization will be downloaded, and where that item was downloaded to.
Thank you,
Zach