Bug report #19981
Value relation, value 0 = NULL
|Affected QGIS version:||3.2.3||Regression?:||No|
|Operating System:||Windows 10||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||27803|
I have a value of 0 in a column of data type integer.
The column is set to widget type "Value relation", relating to a table having descriptions for each possible value. However if I tick Allow NULL value, existing objects having value 0 are shown as (No selection) instead of the proper value from the drop down relating to value 0.
Relating to the issue, testing it further:
- When the form shows after digitizing the Value relation widget is completely blank by default when Allow NULL value is on. However sometimes it is set to (No selection) by default I haven't been able to find out when it does that and when it doesn't. - But couldn't this be case either way that the default value in the drop down is (No selection) when no other default value has been set?
- When default value is set to 0, the default value is (No selection) instead of the value 0 from the drop-down.
#3 Updated by Casper Bertelsen over 2 years ago
- File zero_null.zip added
Sure, i have exported two tables into a geopackage (originally from postgres). One polygon layer as well as a layer without geometry (look up). In the project I have linked to the polygon layer twice, so it’s easy to see the actual value as well as how it results using value relation.
As you can see the existing polygon is set to no selection even though it has the value 0, represented in the look up-table. If you digitize a new polygon, I have set the relation to default to zero however this results in no selection by default.