I'm trying to make a style based on rules, and I want to use a boolean field I have created for that.

But I do the following:

"field" like 'TRUE'
"field" like TRUE
"field" like 1
"field" like '1'

and nothing is selected.

How can I select true values in a boolean field then? I'm using QGIS reading from PostGIS database.

  • 1
    Would you be able to edit your question to include the GIS software that you are using, please ?
    – PolyGeo
    May 25 '15 at 20:11
  • 4
    I don't think the boolean field supports the like operator, try "field" = 1 instead. May 25 '15 at 21:18
  • What data source are you using? QGIS doesn't even support creating bool fields in new Shapefiles or Spatialite afaik.
    – underdark
    May 25 '15 at 21:54
  • Sorry: I'm using a postGIS database May 25 '15 at 22:06

When using a boolean, you need to use the IS operator instead of LIKE. So your expression should be:

"field" is true

However, since you want to select the fields which are TRUE, you can also shorthen this and use this expression:


This works because in QGIS the fields will be selected, where the used expression returns TRUE. So on a booleanfield it is enough when the content is TRUE and therefore returning TRUE when evaluating it.


enter image description here


Finnally I have found the solution:

"field" like 't'

Thank you


I would recommend, in order to see how QGIS views the values, to use the "all unique" button.

You should get a list of values.

enter image description here

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.