Skip to content

Confusion with Boolean and Integer Values in the Expression Engine #62598

Open
@esnyder-rve

Description

@esnyder-rve

What is the bug or the crash?

When evaluating a boolean expression such as "Field_A" IS NULL, the expression editor will show the result as either 1 or 0. This value appears to be an integer, but does not behave like one. Math, for instance, cannot be done against this value. These expressions will need to be converted with to_int() first (which is confusing because why would I need to convert 0 or 1 to an integer, it "already is one").

This is inconsistent with other aspects of the expression editor where some boolean operations will result in true or false explicitly (such as overlay_within())

I think the ideal solution would be to fix the integer-like returning expressions to instead return true or false explicitly.

Steps to reproduce the issue

  1. Create an expression such as "Field" IS NULL + 10
  2. Notice the value is not either 10 or 11.

Versions

QGIS version3.44.0-Solothurn
QGIS code revision5d9ba037df1
 
Libraries
Qt version5.15.13
Python version3.12.11
GDAL version3.11.0 (Compiled)
3.11.3 (Running) — Eganville
PROJ version9.6.2
EPSG Registry database versionv12.013 (2025-05-26)
GEOS version3.13.1-CAPI-1.19.2
SQLite version3.46.1
PDAL version2.9.0
PostgreSQL client version17.3
SpatiaLite version5.1.0
QWT version6.3.0
QScintilla2 version2.14.1
OS versionWindows 11 Version 2009
 
Active Python plugins
db_manager0.1.20
grassprovider2.12.99
processing2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugEither a bug report, or a bug fix. Let's hope for the latter!ExpressionsRelated to the QGIS expression engine or specific expression functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions