Hi,
I am trying to evaluate an expression on a selected feature in my Python
code.
Here is my code:
-----------------
selFeature = selectedFeatures[0]
context = QgsExpressionContext()
scope = QgsExpressionContextScope()
scope.setFeature(selFeature)
context.appendScope(scope)
exp = QgsExpression('represent_value(routenr)')
routenNameNr = exp.evaluate(context)
------------------
The code above works fine for a "normal" expression, like e.g.
"$length", but it fails for "represent_value(fieldname)". I guess this
is because represent_value involves another layer (relation reference
widget). How could I enhance my code so that
"represent_value(fieldname)" would also work?
Thanks a lot for your hints!
Andreas
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer