4

I am trying to create a field that shows the following different categories in the same field:

Variable = verschil bouwhoogte

"Verschil bouwhoogte" <3
"Verschil bouwhoogte" => 3 and  "Verschil bouwhoogte" < 6  
"Verschil bouwhoogte" >=6 and "Verschil bouwhoogte" <9
"Verschil bouwhoogte" >9

So far i can only get it to work using a new field for each expression

2
  • 1
    Difficult to understand what you are trying to select with your expression. Can you explain with words which values you are trying to select? And a screenshot showing the attribute table
    – BERA
    Feb 21 at 11:46
  • While the question about what you want to do with your expression is unclear, the expression needs to be corrected. At least, it should be written like this "Verschil bouwhoogte" >= 3 and "Verschil bouwhoogte" < 6 and "Verschil bouwhoogte" >= 9. The equal sign comes after the greater than sign.
    – ahmadhanb
    Feb 21 at 12:08

2 Answers 2

6

In the Field Calculator, you can use the following expression:

CASE 
    WHEN  "value" < 3 THEN 'cat_01' 
    WHEN  "value" >= 3 AND "value" < 6 THEN 'cat_02'
    WHEN  "value" >= 6 AND "value" < 9 THEN 'cat_03' 
    WHEN  "value" >= 9 THEN 'cat_04'
    ELSE 'cat_00'
END

enter image description here

1
  • Thanks that worked perfectly :)
    – Mees
    Feb 22 at 11:25
2

EDIT

I deleted my very short answer, as it was clearly not the answer OP needed. My answer consisted mostly of an image, with the idea that OP could find more information in the online manual of QGIS, in the language of his choice. But I understand now that this is not the way of StackExchange. I strive to do better next time.

2
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Feb 21 at 21:40
  • 1
    You should provide a little bit more text to your answer. The bot just reads your text and can't find an answer. Describe what you do as provided in the image.
    – Xeppit
    Feb 21 at 21:49

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.