3

I am working in QGIS and trying to create a landcover vector for a project. I have multiple columns with different attributes. As shown below:

enter image description here

I was trying to create a three letter code in the "ECcode" column using a CASE statement but it was taking a long time and kind of painful to do. Is there an expression I can use that can simply add the values in the "HCcode", "MCCode" and "ECcode" columns together so I could get values like "HWDAG", "HWDCO" and so forth?

Taras
35.8k5 gold badges77 silver badges151 bronze badges
asked Mar 7, 2022 at 1:49

1 Answer 1

3

You can simply use the following expression to update the field ECcode:

 upper( "HCcode" || "MCCode " || "LCCcode" )

It will concatenate all the values in the three columns and change the case to uppercase. If you do not want the values to be uppercase, then remove the upper() expression.

answered Mar 7, 2022 at 2:58
2
  • 1
    For having a space or a different symbol in between use the "HCcode" || '-' || "MCCode " etc. Commented Mar 7, 2022 at 6:41
  • This is great! Thank you. Commented Mar 7, 2022 at 23:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.