I have two layers which I want to connect using the aggregate()
function with the Field Calculator. I can do this using the processing tool:
processing.run("native:aggregate", {
'INPUT' : 'XX.gpkg|layername=obj_flurname',
'GROUP_BY' : '"Aufn_Nr"',
'AGGREGATES': [
{'aggregate': 'first_value','delimiter': ',','input': '"Aufn_Nr"','length': 50,'name': 'Aufn_Nr','precision': 0,'sub_type': 0,'type': 10,'type_name': 'text'},
{'aggregate': 'concatenate_unique','delimiter': ', ','input': '"name"','length': 254,'name': 'name','precision': 0,'sub_type': 10,'type': 11,'type_name': 'stringlist'}],
'OUTPUT' : 'TEMPORARY_OUTPUT'
})
When I want to implement the same thing in the Field Calculator, I don't have the option to group_by
like in the native:aggrregte
function. Is it possible to add this group_by, or do I have to run this with the advanced field calculator (with Python)?
My efforts so far:
aggregate(
layer:='XXX_1da2ccba_0147_4280_a0e9_439870e296c4',
aggregate:='concatenate_unique',
expression:="name",
concatenator:=', '
)
But this only aggregates all possible unique values to all rows. How could I change this so that it works?