2

I'm having an attribute table like this of a shapefile on QGIS:

Movie / Actor

A / 1

A / 2

A / 3

B / 4

I want to get the name of a movie and all actors in that movie, and I want the result to be in a format like this:

Movie / ActorList

A / 1, 2, 3

B / 4

How can I do it?

4
  • Which kind of geoprocessing are you thinking to modify the attribute table grouping observations like this?
    – aldo_tapia
    Commented Aug 2, 2017 at 18:53
  • We do this in PostgreSQL using the string_agg() function... I think is similar to the QGIS aggregate function though I can't seem to figure out how to get it to work Commented Aug 2, 2017 at 19:02
  • The table ahead is just an example. I want to dissolve a feature based on the categoriy (MOVIE) and create a new column with all the other attributes concatenated (ActorsList). The real situation is that i have multiple polygons with the category CITIES and the attributes like FOREST, URBAN AREAS, ETC. I want to dissolve with the field CITIES and bring in another column all the attributes of the original shapefile. Commented Aug 3, 2017 at 18:37
  • Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq.
    – underdark
    Commented Feb 16, 2019 at 18:11

1 Answer 1

4

As DPSSpatial commented, QGIS aggregate function has concatenate().

Just make sure the Output field length is long enough.

enter image description here

Expression is: concatenate("Actor", group_by:="Movie", concatenator:=', ')

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.