3

I'm pretty green when it comes to QGIS. I have a shapefile with a bunch of fields and farm codes of whats growing in them. However there are like 600 of them, so I want to go through and simplify. So All values that represent a type of fruit tree will just be one value.

How can I implement a function along the lines of 'IF 'field value' = x,y,z THEN = Q?'

and where would I implement that? Somewhere in the attribute table right?

3 Answers 3

4

You can use "Field Calculator" enter image description here in QGIS.

enter image description here

  • Open "Field Calculator"

  • Enter Output field name

  • Select String as Output field type

  • Set the Output field length

  • Add an expression like below: (use double quote (") for field_name, apostrophe (') for strings)

    if("field_name" IN ('x', 'y', 'z'), 'Q?', '')
    
2

Try if("fieldname" in ('x','y','z'),'value if true','value if false') in the attribute table via field calculator. Note that '' are used for string values. If you have numeric values use the same expression without ''.

0

You can use the "Field Calculator".

Field Calculator

Then, just build your expression in the left-hand box in the new window.

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.