QGIS 3.28 LTR
I am trying to write an expression for a calculated field to return an attribute from at non-spatial layer.
The calculated field is on the layer 'tree-pt'.
The target attribute is on the layer 'photos', which amongst others has attributes "path", "tag", "fk_layer" and "fk_uuid". The latter two attributes are used in the polymprhic relation between the layers 'tree-photo_tree-pt'
There may be several photos related to a tree-pt. I want the value of the attribute "path", where "tag"='T'. I can't seem to find an expression that allows me to do this.
relation_aggregate() doesn't work because it doesn't have a filter to narrow the results to only those with "tag"='T'.
When I use aggregate(), which has a filter expression, I can't get the filter to work when trying to match "uuid" from 'tree-pt" to "fk_uuid" from 'photos'.
The following expressions find no match when I know there is one.
aggregate( 'photos', 'array_agg', "path", "fk_uuid"=uuid)[0] aggregate( 'photos', 'array_agg', "path", "fk_uuid"='uuid')[0] aggregate( 'photos', 'array_agg', "path", "fk_uuid"="uuid")[0] aggregate( 'photos', 'array_agg', "path", "fk_uuid"=attribute(@feature,'uuid')[0] If I enter a known uuid match, in the following format, it returns the desired result:
aggregate( 'photos', 'array_agg', "path", "fk_uuid"='{12345678-2x22-3y3y-z123-xxx12y3za45b}')[0] How can I get the filter to work on uuid? Or, is there another function I can use for this?