In QGIS 3.16. I am using the Aggregate function to reduce the number of features in a layer. I am grouping by one field and I want to concatenate the others.
My actual data table is fairly large and the operation seems to be working for some of my fields, but for some fields, I get an error message related to the concatenation, and for the life of me I can't figure out why.
Here is a screenshot of my Aggregate setup for a truncated version of my table, with a few of the features that are having problems. I am grouping by the field "Complexe"
; note that all output field types are set to String (Text) with a length of 100, so that is not the issue:
enter image description here
This is the message that I get : enter image description here
Evaluation error in expression "concatenate("ID_CH","Complexe",TRUE,',')": Could not calculate aggregate for ID_CH. Execution failed after 0.86 seconds.
Here are the files if you'd like to try and reproduce the problem: https://drive.google.com/drive/folders/1nOV1dxZWzNiIg9F77brQ36Rcvoze8QSb?usp=sharing
-
please do not put text in your question as an image - this makes it unreadable for many users (including Google)Ian Turton– Ian Turton2021年05月18日 10:10:33 +00:00Commented May 18, 2021 at 10:10
-
Hi Ian, I used the native 'add picture' function. Would it be better to post a link to the picture? Or is there another way of loading a picture onto SE? Sorry for the newbie errors, I'll get the hang of it...pete– pete2021年05月18日 10:38:37 +00:00Commented May 18, 2021 at 10:38
-
You should copy and paste the actual text into the questionIan Turton– Ian Turton2021年05月18日 10:58:28 +00:00Commented May 18, 2021 at 10:58
1 Answer 1
The string function raised 'Evaluation error'
because it couldn't parse the input.
To overcome it wrap each of your fields into the to_string()
function in the 'Source Expression'
and get the output
Also mind the length of the output field.
Additionally, before aggregation I may suggest checking the validity of geometry of your features, e.g. with the "Check Validity" or the "Geometry Checker Plugin". Otherwise you will face similar issues as I had:
and others...
-
1Simple and effective. Thanks for patiently helping me see what was right in front of me but which I hadn't noticed! Also thanks for the plugin suggestions.pete– pete2021年05月18日 14:39:11 +00:00Commented May 18, 2021 at 14:39
-
Explore related questions
See similar questions with these tags.