I am creating an atlas using QGIS v3.12 but would ideally like to include a dynamic text box that takes values from multiple layers contained on each atlas feature page.
The map is made up of two layers ('zones' & 'networks') 'zones' used to generate the atlas, but I'd like to include some of the attributes from 'networks' including 'total_properties'.
I've tried using:
aggregate(
layer:='networks',
aggregate:='concatenate',
expression:="total_properties",
filter:=intersects($geometry,@atlas_geometry),
concatenator:=','
)
But it returns the error "Eval Error: Could not calculate aggregate for: total_properties".
It only seems to work if the attribute name is common with the 'zone' layer (they are different geometry types from different sources but have some common attributes). I even created an attribute table for 'networks' and copied the attribute names from the expression builder to ensure they're spelt correctly.
1 Answer 1
This is probably because your total_properties
field is numeric and concatenate
only works on string data types (why QGIS doesn't autoconvert numeric values for this is beyond me - perhaps in a future release).
Try using expression:=to_string("total_properties")
in your expression and see if that works.
-
Fantastic - thank you!! Ended up using 'expression:=format_number(total_properties,0),' but worked perfectly!Adrian– Adrian2020年06月09日 07:46:29 +00:00Commented Jun 9, 2020 at 7:46