Hi, I've started a PR with the aggregate expression example here: https://github.com/qgis/QGIS-Documentation/pull/3769
Regards, Anita On Tue, May 21, 2019 at 12:15 AM Nyall Dawson <nyall.daw...@gmail.com> wrote: > On Tue, 21 May 2019 at 05:53, Anita Graser <anitagra...@gmx.at> wrote: > > > > Dear Nyall, > > > > for f in vl.getFeatures(): > > scope[-1].setFeature(f) > > This works, but isn't very nice. Better to use > > context.setFeature(f) > > (behind the scenes it's doing the same, but is more descriptive and > has some extra checks, e.g. starting with an empty context: > context = QgsExpressionContext() > context.setFeature(f) > will automatically add an initial scope in which to set the feature) > > > scope = QgsExpressionContextUtils.globalProjectLayerScopes(vl) > > Being pedantic, this should be "scopes = ...", since the call returns > a list of scopes. > > Nyall >
_______________________________________________ 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