def input(self,feature):...myAnswerField = [('Echelle1',None),('Echelle2',None)]with this database :
if '01' in feature.getAttribute('id_reseau'): scale1 = feature.getAttribute('echellesortieplanprincipal') myAnswerFields.remove(('Echelle1',None)) myAnswerFields.append(('Echelle1',scale1)) if '02' in feature.getAttribute('id_reseau'): scale2 = feature.getAttribute('echellesortieplanprincipal') myAnswerFields.remove(('Echelle2',None)) myAnswerFields.append(('Echelle2',scale2))
I think you are mixing up local and global variables,but please post your whole code so we can see what's going wrong.
I suspect this question would be more suitable in a Python forum.
Anyway,it's difficult to help unless you post the whole code and tell us precisely what you want to achieve.