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.
updateFeaturecall inside your loop. The answer in the question @Fran Raga linked to above should help. – Ben W Aug 01 '19 at 22:27