7

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)?

1
  • 3
    Try this regexp_replace('{"Roots","Trunk","Braches","Leaves","Twigs"}','\\{|}|"','')
    – Taras
    Nov 26, 2020 at 12:45

1 Answer 1

3

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.

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.