I need to styling/labeling some specific features in a vector layer. I thought I could use the rule-based option in the style/label window with a "field=value" expression if i have only one specific feature.

Which expression I should use if I have many specific features?

  • 5
    "field" IN ('value1', 'value2', 'value3') etc. – Joseph May 4 '18 at 14:58
  • if I understood correctly it should be, i.e .: "codice IN (13, 15, 18)" for the specific features, "codice=ELSE" for all the other features? – Andrew-63 May 4 '18 at 15:22
  • 1
    Careful with your quotes. Use double for field names; single for values. You can create two rules, the first can have the expression: "codice" IN ('13', '15', '18'). The second rule can have "codice" = 'ELSE'. – Joseph May 4 '18 at 15:28
  • Thanks a lot! Where could I find some informations about creating expressions and their syntax? – Andrew-63 May 4 '18 at 15:33

You could use the following expression to style/label specific attribute values:

"fieldName" IN ('value1', 'value2', 'value3')

For more information, you can check the QGIS documentation for expressions.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.