Aggregate function with filter doesn't work in layout manager #45552
Labels
Bug
Either a bug report, or a bug fix. Let's hope for the latter!
Print Layouts
Related to QGIS Print Layouts, Atlas or Reporting frameworks
What is the bug or the crash?
I have a point layer named "Observation", with different attributes and one called "field_year" (date). My project also have a variable called @year.
In the layout, I have a A0 page (1189x841), but I want an extra space to put my attribute table (1cm for each row). So I'm trying to calculate the size with this formula, and it's worked fine:
841 + (10 * layer_property('Observation', 'feature_count'))
My problem is that my attribute table shows only the observations for the given year (@year), with this formula as a filter:
to_string(year("field_year")) LIKE @year
So to be able to count only the number of rows for a given year, I want to use the "aggregate" function, like this (single or double quotes for attributes doesn't change anything):
But it always says "No feature was found to evaluate the expression".
If I use the same expression to calculate a field in the attribute table, the function works (the pictures shows attributes in French, but it's the same).
Steps to reproduce the issue
Versions
Version de QGIS
3.16.10-Hannover
Révision du code
e5b665e
Compilé avec Qt
5.15.2
Utilisant Qt
5.15.2
Compilé avec GDAL/OGR
3.3.1
Utilisé avec GDAL/OGR
3.3.1
Compilé avec GEOS
3.9.1-CAPI-1.14.2
Utilisé avec GEOS
3.9.1-CAPI-1.14.2
Compilé avec SQLite
3.35.2
Fonctionne avec SQLite
3.35.2
Version du client PostgreSQL
13.0
Version de SpatiaLite
5.0.1
Version de QWT
6.1.3
Version de QScintilla2
2.11.5
Compilé avec PROJ
8.1.0
Fonctionne avec PROJ
Rel. 8.1.0, July 1st, 2021
Version de l'OS
Windows 10 Version 2009
Extensions Python actives
AnotherDXF2Shape;
AppendFeaturesToLayer;
autoSaver;
CalculateGeometry;
catalogotf_plugin;
changeDataSource;
color_attribute;
DataPlotly;
DigitizingTools;
lizmap;
loadthemall;
LocatePoints;
lrs;
MapsPrinter;
mask;
menu_from_project;
Mergin;
profiletool;
qgis2web;
slyr_community;
SpreadsheetLayers;
swissgeodownloader;
swiss_locator;
TomBio;
VectorBender;
ViewshedAnalysis;
db_manager;
processing
Supported QGIS version
New profile
Additional context
The "aggregate" function shows no error in the layout manager, if we don't add a filter. But the value is always zero.
The text was updated successfully, but these errors were encountered: