Hi Graeme,
I think this may be a bug, it appears that this worked at some point,
https://gis.stackexchange.com/questions/222625/qgis-relation-aggregate-how-does-this-work#238265
The QEP referenced above is still open:
QEP 59: Aggregate functions for QGIS expressions · Issue #59 ·
qgis/QGIS-Enhancement-Proposals
but it may not be working anymore?https://github.com/qgis/QGIS/issues/29115
I tried dumping the expression results to a field in field calculator. I am
able to get output only by referencing field names that are common in both the
1 and the many table, for example using the relation between Canadian Provinces
and Regional Districts, only the province UID gives anything besides NULL:
relation_aggregate('RDs_in_Provinces','concatenate',"PRUID")
-Thayer
On Wednesday, April 6, 2022, 07:40:08 AM EDT,
[email protected] <[email protected]> wrote:
> PUBLIC
> Hello,
> I am having issues getting relate_aggregate to do anything within expression
> builder. Ideally, I would like a features (1) to (m) attributes table setup
> correctly with a relationship to allow a user to select attributes based on
> attribute criteria have the corresponding related features selected / shown
> on map as related. Given how little I am uncovering online about ways to do
> this, it might not be possible, but even getting the expression builder to
> update a field in my features with a count of corresponding values in
> attributes is not updating feature's values, I am wondering if I am doing
> something wrong. Should this work?
> Within select by attributes for the feature table:
> relation_aggregate( 'relation _ID','count',1) > 3
> The preview of the expression returns a value for a feature (without the >3
> at end), but when I try to calculate a field of this count - every value
> returns NULL. With the >3 it does not work at all to select anything.
> It does look like 'relation_aggregate( 'relation _ID','count',1)' is fine for
> the basis of evaluating a field of values based on preview but it returns
> null on running the field calculator.
> I am using QGIS 3.16
> Regards,
> Graeme
> PUBLIC
_______________________________________________
Qgis-user mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user