6

Trying to create an expression to display labels from a field called "Drilled ID", but only if the field named "Status" contains 'Week' or 'Active' but to no avail. If the "Status" field contains anything other than these two options, then it can be left blank.

I have tried this:

case
  when "Drilled ID" = 'Week' or 'Active'
    then "Drilled ID"
end

I can get it to work by creating two different rules on rule-based labelling, but I was wondering if there is another way?

1
  • 2
    Try this: when "Drilled ID" = 'Week' or "Drilled ID" = 'Active'
    – Babel
    Mar 5 at 13:21

2 Answers 2

10

Use this:

CASE
  WHEN "Status" IN ('Week', 'Active')
    THEN "Drilled ID"
END
8

I found another solution.

Case
When "Status" like 'Active' or "Status" like 'Week' 
Then "Drilled ID"
End

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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