[Qgis-user] How to filter expression in aggregate
Let's say I have two layers with the following attributes: Layer A - SOVEREIGNT, Field2, Field3, ... Layer B - Country_Region, Confirmed, ... I want to aggregate the Confirmed field of Layer B into Layer A. I try to create a virtual field in Layer A with the _expression_ aggregate( 'B','sum', "Confirmed", "Country_Region" ILIKE attribute($currentfeature, 'SOVEREIGNT')) but the value is always zero. What am I not understanding? Thanks David ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] How to filter expression in aggregate
On 3/14/2021 5:28 PM, Andrea Giudiceandrea wrote: David Strip-4 wrote aggregate( 'B','sum', "Confirmed", "Country_Region" ILIKE attribute($currentfeature, 'SOVEREIGNT')) Hi David, in the filter the source feature can be accessed with the variable @parent https://docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/functions_list.html#aggregate aggregate( 'B','sum', "Confirmed", "Country_Region" ILIKE attribute(@parent, 'SOVEREIGNT')) that did it. Does that mean that attribute(@parent, ...) is the value of the attribute for the feature for which the attribute is being calculated? And what does $currentfeature mean? Is it evaluated to the current feature of Layer B, not A? ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] How to filter expression in aggregate
David Strip-4 wrote > aggregate( 'B','sum', "Confirmed", "Country_Region" > ILIKE attribute($currentfeature, 'SOVEREIGNT')) Hi David, in the filter the source feature can be accessed with the variable @parent https://docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/functions_list.html#aggregate aggregate( 'B','sum', "Confirmed", "Country_Region" ILIKE attribute(@parent, 'SOVEREIGNT')) Regards. Andrea -- Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user