1

I have a layer with a Boolean field called bool. I can set the field value to NULL, e.g. using the Field Calculator.

When printed via Python, the values are correctly shown as None:

>>> layer = iface.activeLayer()
>>> [f.__geo_interface__ for f in layer.getFeatures()]
[{'type': 'Feature', 'properties': {'bool': None}, 'geometry': ...}]

In the attribute table they are shown in grey, indicating that they are NULL too:

enter image description here

If I edit one of them to be true, the true value is correctly shown in the attribute table:

enter image description here

Via Python I also get the correct value: {'bool': True}

Now how can I reset the value to be blank/NULL/None again via the attribute table or the attribut form?

In the attribute table I get a checkbox that I can toggle. There is no reset icon or anything like that:

enter image description here

In the attribute form there is a similar checkbox, also no way to reset the value:

enter image description here

I am not looking for workarounds in any way, I want to know if there is a way for users to reset a boolean field to be empty using the attribute table or attribute form.

1 Answer 1

0

According to https://github.com/qgis/QGIS/issues/44556 this is not possible in QGIS at the moment and that is considered to be a bug.

There was also some related discussion of other confused users in Can a Geopackage Boolean field contain a NULL value?

Your Answer

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

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