Updating an attribute on the Feature Layer tied to a Survey123 Survey

101
1
06-07-2018 05:19 PM
Highlighted
New Contributor III

I have a survey in Survey123, I added a field to the Feature Layer associated with that survey that's not one of the survey questions. I'm trying to update the value of the field using set_value(field_name, value). The method is returning true, yet the new value isn't actually getting updated when I check in AGOL.

lyr = FeatureLayer(url, gis)

rows = lyr.query(where clause)

for row in rows.features:

    status = row.set_value("field name", "field value")

    print(status)

status will be True, yet the new value isn't sticking

Reply
0 Kudos
1 Reply
Highlighted
New Contributor III

For those who may come across this thread in the future, the "set_value" method changes the value in memory. To then make the edit permanent, you pass in the Feature object to lyr.update_features() or lyr.edit_features().

Reply
0 Kudos