Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
qgib opened this issue Apr 10, 2019 · 6 comments
Closed

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

qgib opened this issue Apr 10, 2019 · 6 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Forms Regression Something which used to work, but doesn't anymore

Comments

@qgib
Copy link
Contributor

qgib commented Apr 10, 2019

Author Name: Robin Rotsaert (Robin Rotsaert)
Original Redmine Issue: 21824
Affected QGIS version: 3.6.0
Redmine category:edit_widget


This was subject of an old bug report (#17511) , 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.


@qgib
Copy link
Contributor Author

qgib commented Apr 10, 2019

Author Name: Giovanni Manghi (@gioman)


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.


  • category_id was changed from Forms to Edit widget
  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Apr 11, 2019

Author Name: Robin Rotsaert (Robin Rotsaert)


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


  • 14777 was configured as qgis_test_valuemapwidget.jpg

@qgib
Copy link
Contributor Author

qgib commented Apr 11, 2019

Author Name: Alessandro Pasotti (@elpaso)


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.

@qgib
Copy link
Contributor Author

qgib commented Apr 11, 2019

Author Name: Robin Rotsaert (Robin Rotsaert)


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.

@qgib
Copy link
Contributor Author

qgib commented Apr 11, 2019

Author Name: Alessandro Pasotti (@elpaso)


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!


  • status_id was changed from Feedback to Rejected
  • resolution was changed from to invalid

@qgib qgib closed this as completed Apr 11, 2019
@qgib
Copy link
Contributor Author

qgib commented Apr 11, 2019

Author Name: Robin Rotsaert (Robin Rotsaert)


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.

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Forms Regression Something which used to work, but doesn't anymore labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Forms Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

No branches or pull requests

1 participant