Bug report #15215

Cannot set value to NULL in value map

Added by Daan Goedkoop over 8 years ago. Updated over 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Edit widget
Affected QGIS version:2.18.11 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:23152

Description

The "value map" widget does not handle NULL values. The code in qgsvaluemapsearchwidgetwrapper.cpp does not have any handling of NULL values, like the other editing widgets have.

In particular, this makes it impossible to reset values to NULL using the "value map" widget.

(When using shape files, numerical values can be reset to NULL by using an empty string as value, but with other providers such as PostGIS, this only leads to the error message that '' is not a valid numerical value.)


Related issues

Related to QGIS Application - Bug report #15886: MSSQL Value Map and NULL value Closed 2016-11-23

Associated revisions

Revision d2c98634
Added by Daan Goedkoop over 8 years ago

Add null handling to value map edit widget (fixes #15215) (#3274)

  • Add null handling to value map edit widget (fixes #15215)
  • Return QVariant type
  • Use hardcoded value for 'null' representation
  • Detect "null" value when loading value map from csv; use null QString constructor
  • Use configured "null" representation for display in value map
  • Use single definition for value map null representation guid
  • Added unit test for value map widget and fixed value displaying bug

Revision 73f7bd3e
Added by Daan Goedkoop over 6 years ago

Add null handling to value map edit widget (fixes #15215) (#3274)

  • Add null handling to value map edit widget (fixes #15215)
  • Return QVariant type
  • Use hardcoded value for 'null' representation
  • Detect "null" value when loading value map from csv; use null QString constructor
  • Use configured "null" representation for display in value map
  • Use single definition for value map null representation guid
  • Added unit test for value map widget and fixed value displaying bug

(cherry picked from commit d2c986343c5311dfd05cc819fe9807e53259c035)

History

#1 Updated by Daan Goedkoop over 8 years ago

  • Status changed from Open to Closed

#2 Updated by Saber Razmjooei almost 8 years ago

  • Status changed from Closed to Reopened

It is still present in the latest 2.14

#3 Updated by Giovanni Manghi over 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#4 Updated by Andre Jesus over 7 years ago

This would be really helpful to have.

#5 Updated by Giovanni Manghi over 7 years ago

  • Description updated (diff)

Andre Jesus wrote:

This would be really helpful to have.

still true for 2.18.11? or master?

#6 Updated by Giovanni Manghi over 7 years ago

  • Status changed from Reopened to Feedback

#7 Updated by Jürgen Fischer over 7 years ago

#8 Updated by Andre Jesus over 7 years ago

Giovanni Manghi wrote:

still true for 2.18.11? or master?

Yes, tested on 2.14.17 and 2.18.11

#9 Updated by Giovanni Manghi over 7 years ago

  • Status changed from Feedback to Open
  • Affected QGIS version changed from 2.14.3 to 2.18.11

#10 Updated by Daan Goedkoop over 7 years ago

The fix from #1 is in Master, but apparently hasn't been backported to 2.18.

#11 Updated by Giovanni Manghi over 7 years ago

Daan Goedkoop wrote:

The fix from #1 is in Master, but apparently hasn't been backported to 2.18.

"master" from July 2016 was already the branch for QGIS 3?
https://github.com/qgis/QGIS/pull/3274

#12 Updated by Daan Goedkoop over 7 years ago

Apparently. I thought it was in time for the 2.18 feature freeze, but I cannot find the commits anywhere in the 2.18 branch. But they are in master.

(Personally I wouldn't mind this to be in 2.18, because at my work I now maintain a custom 2.18 branch/fork with just this patch.)

#13 Updated by Giovanni Manghi over 7 years ago

(Personally I wouldn't mind this to be in 2.18, because at my work I now maintain a custom 2.18 branch/fork with just this patch.)

then please submit a new PR! :) we all will appreciate that. cheers!

#14 Updated by Daan Goedkoop over 6 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF