TransWikia.com

Convert a list to string in QGIS

Geographic Information Systems Asked by Serggg182 on December 4, 2020

I have edited a field into the attribute form of a QGIS project as a "Value Relation" to create a checkbox where I can choose few possibilities. I have a tree sickness and the field I am talking about is the LOCATION where the sickness is visible: Roots, leaves, trunk, branches, twigs. The thing is that the output of all of that when I open my attribute table after typing the data it is like this in case the sickness is in all parts of the tree:

{"Roots","Trunk","Braches","Leaves","Twigs"}

Is there anyway where I can transform this into a normal string when it comes to be readable on the attribute table like Roots, Trunk, Branches, Leaves and Twigs (without the and also good solution but for sure without curly braces and quotation marks)?

One Answer

If you try to change/remove curly brackets in-place, you ruin "Value Relation" concept. Therefore, you should add a new field and use an expression like this:

replace(regexp_replace("LOCATION", '\{|}|"', ''), ',', ', ')

It removes {, }, " and changes,(comma) to , (comma+space). It changes, for example, {"Roots","Branches","Twigs"} to Roots, Branches, Twigs.

Answered by Kadir Şahbaz on December 4, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP