0

I'm tring to update the attributes of a field based on the attributes of another field as follows:

def vulProcessing(layer):
    layerV=QgsVectorLayer(layer,'','ogr')
    layerV.startEditing()
    for feature in layerV.getFeatures():
        if feature['Old'] == "H":
            feature['New'] = 'ddw'
    layerV.updateFeature(feature)
    layerV.commitChanges()

The code runs without error but the attribute table does not update.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
user1655130
  • 650
  • 5
  • 13
  • 1
    possible duplicated https://gis.stackexchange.com/q/316958/49538 – Fran Raga Aug 01 '19 at 16:13
  • Probably you just need to put the updateFeature call inside your loop. The answer in the question @Fran Raga linked to above should help. – Ben W Aug 01 '19 at 22:27

0 Answers0