4

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

Taras
35.8k5 gold badges77 silver badges152 bronze badges
asked May 18, 2021 at 8:40
3
  • please do not put text in your question as an image - this makes it unreadable for many users (including Google) Commented 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... Commented May 18, 2021 at 10:38
  • You should copy and paste the actual text into the question Commented May 18, 2021 at 10:58

1 Answer 1

7

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'

aggregate_window

and get the output

result

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:

geometry_1 geometry_2

and others...

answered May 18, 2021 at 10:41
2
  • 1
    Simple 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. Commented May 18, 2021 at 14:39
  • Always welcome! Commented May 18, 2021 at 14:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.