<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 20, 2019 at 2:37 AM Nyall Dawson <<a href="mailto:nyall.dawson@gmail.com">nyall.dawson@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, 20 May 2019 at 01:21, Anita Graser <<a href="mailto:anitagraser@gmx.at" target="_blank">anitagraser@gmx.at</a>> wrote:<br>
> I'd like to add an example of an aggregate expression to my recent PyQGIS 101 tutorial on expressions [0]. I got expressions for individual features working but cannot figure out how to set the context for aggregate expressions correctly.<br>
> As far as I can tell, the PyQGIS Cookbook doesn't contain any information on this either [1].<br>
<br>
You aren't correctly constructing your expression context:<br>
<span class="gmail_default" style="font-size:small">... </span> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">A documentation update covering this would be most welcome ;)</blockquote><div> </div><div><div class="gmail_default" style="font-size:small">Thank you Nyall, that's really helpful! The expression system is awesome and powerful but I don't think anyone could guess how to use it correctly in PyQGIS.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'll write it up into a tutorial and the documentation team is always welcome to reuse the content in the official documentation. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Regards,</div><div class="gmail_default" style="font-size:small">Anita</div><br></div><div> </div></div></div>