I want to select elements from a layer. The field I use is a string/character field. My code is as follows:
expr = QgsExpression(ur'"myField" = \'valueILookFor\'')
it = myLayer.getFeatures(QgsFeatureRequest(expr))
ids = [i.id() for i in it]
myLayer.setSelectedFeatures (ids)
I do know that the error lies in the first line, as I've already used the rest of the code (which is from stackexchange) for selecting values.
Apparently this does not select any value. I have tried to replace the "=" with a "LIKE" without more success.
expr = QgsExpression( """ "myField"= 'valueILookFor' """)– Steven Kay Jan 27 '16 at 14:24