I have a STRING field with values. When I want to apply some additional text after each value using an array function, I get the text added to the end of the whole initial string instead of each value. I tried space separated values, coma separated values, coma separated values with spaces but nothing is working.
Values can be numbers or letters, like 1 5 XY for example.
I applied the following expression in a virtual field calculator:
array_to_string( array_foreach( array("values"),@element || 'sometext' ), ' ' )
QGIS returns me:
1 5 XYsometext
instead of:
1sometext 5sometext XYsometext
"field" || 'text'
or using the functionconcat
. The expression is correct. If your goal is to achieve the result you are showing in your example, considering the different values as different attributes in the same field, you should usearray_agg
insteadarray
.