Friday, 23 November 2018

qgis - How to copy attributes from many columns to one, QGIS3


I have many columns, about 30 and each of those has some attributes. I want to merge those columns to one and collect all attributes in a row of columns. I tried with this post but it is not for I am looking for. Combining Columns QGIS Attribute Table I have an example in ms excel what I want that without commas and spaces. Attributes have to be separated with one comma. enter image description here


With this script, if some fields are empty, I have got null fields. Sorry for my English


enter image description here



Answer



array_filter( map_avals( attributes( )), @element <>'') does the trick.


1/ attributes() get all fields with their corresponding values


2/ map_avals(): gives you just the values as an array


3/ array_filter(array, expression): the expression @element <>'' filters out the empty values


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...