Updating a Form using python

10-29-2019 09:19 AM
New Contributor II

Hi All!, I have a question


Currently, I am using the following python lines to update a form. What I want to update the most is the media file of it, so the survey can do the pulldata of the new registers. 


I run this lines:


#Getting the survey Item I will update

org_gis = GIS('my_http', 'my_user', 'my_pswrd')
srv_to_update = org_gis.content.get('srv_to_update_id')


#The path of the survey, with the new media files

path = ".../ArcGIS/My Survey Designs/survey.zip"


srv_to_update.update(data = path, item_properties={'type' : 'Form', 'title': 'survey', 'tags' : []})


I get:

True as output, and the Form load without errors.


However, when I go to the "updated" survey in my portal the pulldata of the new registers is not working.


Any clue of why is this happening? Should I include another parameter in the update function?


Thank you all in advance!



0 Kudos
5 Replies
Esri Esteemed Contributor

Hi Luisa, 

Just to confirm, we addressed this as a comment in https://community.esri.com/groups/survey123/blog/2017/12/08/an-alternative-way-to-update-the-media-f... , correct?

0 Kudos
New Contributor II

Good day, James,

Yes, it was me also on that comment. 

0 Kudos
New Contributor

I've been working through this procedure of updating the itemsets.csv files for published surveys. I have written a script that does this in Python 3 using the ArcGIS Python API. The script works great, but one issue I've noticed...

When cascading selects are setup, the first select_one list must appear in the 'choices' tab of the xslx form, right? And the subsequent contingent select_one lists can go in the 'external_choices' tab. (At least it yells at me when I remove the first list from the 'choices' tab)

Well the problem is that when I push an updated itemsets.csv to the survey that has different choices for the first select_one, those new choices appear but also the original choices remain. For example, if I published the survey with the first list question having Choice1, Choice2, Choice3, and then I run the script to update it and the newly updated first list question should be Choice2, Choice3, Choice4, what actually happens is the list has Choice1, Choice2, Choice3, Choice4 - which causes problems when you require the subsequent lists and selecting Choice1 means you get no choices for the second list.

I thought I might be able to get away just having the first list name in the 'choices' tab with no values, and the survey should pull the values from the itemsets.csv/external_choices but that does not work. I would hate to have to have a 'dummy' placeholder value in those! Anyone have a workaround to this?

0 Kudos
New Contributor

Upon a bit more testing, it seems like updating the itemsets.csv in the media folder only updates the *contingent* picklist, that is the lists that depend on the first list in a cascading select. The first list values seem to ignore what's in the itemsets.csv and honor only what's in the 'choices' tab. This is problematic as we need a way of updating all 3 lists participating in our cascading select, not just the second two!

0 Kudos
Occasional Contributor III

Hi Dylan,

Can you please share how you update media folder with Python API?

0 Kudos