AnsweredAssumed Answered

Unable to get set_value to work when updating the attributes of a feature

Question asked by cwarewa on Apr 24, 2017
Latest reply on Apr 24, 2017 by AMani-esristaff

I'm trying to use the set_value function on a feature in a feature layer hosted on AGOL. The set_value function seems to work and does not return an error but when I query the feature service none of the features have the updated values.

 

I set up a layer:

 

dataSearch = gis.content.search("pointService", "feature service")
for layer in dataSearch[0].layers:
   if layer.properties.name == "pointService":
   pointLayer = layer

 

Then I get the feature set for that layer:

 

updateFeatures = pointLayer.query()

 

Then I try to set the values of some attributes:

 

for feature in updateFeatures.features
   feature.set_value('RegionID', 1)
   feature.set_value('RegionNm', "SouthEast")

 

The updated attributes show up when I use get_value()


print(str(feature.get_value('RegionNm')))

<SouthEast>

 

But when I query the feature service from the REST endpoint or download it as a shapefile, the attributes are empty. I have tried using the refresh() method on the feature layer manager but it had no effect. 

Outcomes