Change the label for a boolean: Instead of "True" and "False" I want the label to display "Occupied."

I have tried many iterations of this expression. Nothing has worked.

Case when "Field Name" = "TRUE" THEN "Occupied"
Else Null
  • Does the field contain strings or some boolean type? You're checking against a string there. – lynxlynxlynx Jan 6 '18 at 23:25
  • TRUE shouldn't be between quotes if it is a boolean, if it is a string it should be in single quotes 'TRUE', "TRUE" would be the name of a field – Elio Diaz Jan 7 '18 at 0:15

You need to use single quotes, both for the value 'true' - should it be saved as a string in "Field Name" (as explained by @Elio Diaz) - and for the word 'Occupied' otherwise the label would contain the value of the column "Occupied", which is unlikely to exist.

Let's note that booleans can be represented in different ways. For instance if you are using Postgres the syntax would be

Case when "Field_Name" = 't' THEN 'Occupied'
  Else NULL

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.