Bug report #21824

value map widget saves description in stead of value to attribute table

Added by Robin Rotsaert 12 months ago. Updated 12 months ago.

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

Description

This was subject of an old bug report (#8818) , but I think it should be reopened. I'm working on Qgis 3.6.0 on Windsows 10. The Value map widget seems to be broken. It doesn't save the value but in stead it saves the description to the attribute table.

qgis_test_valuemapwidget.jpg (329 KB) Robin Rotsaert, 2019-04-11 08:30 AM

History

#1 Updated by Giovanni Manghi 12 months ago

  • Category changed from Forms to Edit widget
  • Status changed from Open to Feedback

You sure? in the context of the QGIS PROJECT where the widget is set it always shows the description. You must check by opening the data source in a different/blank project.

#2 Updated by Robin Rotsaert 12 months ago

I checked again in a blank project and still have the same problem. See attached screenshot. I created a multi-polygon layer in a geopackage and set up the value map widget as shown in the screenshot. Then I created 3 features and assigned a value from the drop-down to each of them. As seen in the screenshot, not the value but the description is saved to the attribute table.

ps: this test was done in QGIS 3.6.1

#3 Updated by Alessandro Pasotti 12 months ago

Did you check what is actually saved into the database?

Because in the attribute table you won't see the actual value but the mapped one.

#4 Updated by Robin Rotsaert 12 months ago

Just checked. In the database the values are saved correct!

So I guess I totally misunderstood the concept of this values-description thing. It wasn't clear for me the values are saved on the level of the database in stead of in the attribute table. I thought its practicality was in giving people the choice of editing by writing down the value (if they know them by heart) or by using the more readable descriptions in the drop-down. But probably it's meant as a means to make bigger databases more lean?

Maybe the misunderstanding occurred to me because when selecting 'Value Map' as a widget type it says underneath the box "Combo box with predefined items. Value is stored in the attribute, description is shown in the combo box" (see screen shot). By saying it is stored in the attribute, I expected it to be shown in the attribute table.
I guess I won't be the only one misunderstanding this, so maybe this should be rephrased and get some extra attention in the user guide? suggestion "Combo box with predefined items. Value is stored in the underlying database, description is shown in the combo box in both the form and the attribute table".

Thanks anyway for the quick responses.

#5 Updated by Alessandro Pasotti 12 months ago

  • Status changed from Feedback to Rejected
  • Resolution set to invalid

Robin Rotsaert wrote:

Just checked. In the database the values are saved correct!

So I guess I totally misunderstood the concept of this values-description thing. It wasn't clear for me the values are saved on the level of the database in stead of in the attribute table. I thought its practicality was in giving people the choice of editing by writing down the value (if they know them by heart) or by using the more readable descriptions in the drop-down. But probably it's meant as a means to make bigger databases more lean?

Maybe the misunderstanding occurred to me because when selecting 'Value Map' as a widget type it says underneath the box "Combo box with predefined items. Value is stored in the attribute, description is shown in the combo box" (see screen shot). By saying it is stored in the attribute, I expected it to be shown in the attribute table.

That was the wrong assumption: the values shown in the attribute table are generated by the widget formatters (this is valid for all widgets).

I guess I won't be the only one misunderstanding this, so maybe this should be rephrased and get some extra attention in the user guide? suggestion "Combo box with predefined items. Value is stored in the underlying database, description is shown in the combo box in both the form and the attribute table".

I would say no: first of all there might be no database if the storage is say a WFS or a shapefile, second, I think "attribute" (without "table") is more appropriate, but I'm not a native english speaker so I might be wrong.

But yes please, make a PR with your proposals for a better wording and feel free to make a PR on the manual to make it clearer.

Thanks anyway for the quick responses.

You're welcome!

#6 Updated by Robin Rotsaert 12 months ago

I think the *.dbf-file of a shapefile can be seen as its underlying database even though it's only one table. As for WFS, I can be wrong, but most times these are not set up to be editable, so setting up a value map widget for these would be like setting up a translation tool to make the given field more readable.

So I think it's better I make those PR's like you suggest.

Also available in: Atom PDF