2

When working with the attribute forms value map or value relation i have found no way to switch between raw field values and displayed values in the attribute table (neither in the project properties nor in the program options). Is there any?

2

Not that I know of. The only way I know of is to change the edit widget type from value map to the default widget for that data type, eg range for numerical fields. That's not a good solution because you'll lose your value map settings. You can save different widget types as separate layer styles, and switch between them, but that's a bit cumbersome.

As a workaround, create a virtual field to display the raw field values.

For example, I have a numerical field "color" with a value-map widget. The user selects a color from the dropdown menu, and the corresponding numerical value is stored in the field. However, in the attribute table you can only see the text name of the color.

enter image description here

So I add a virtual field called "color_code" with the expression "color".

enter image description here

This field displays the raw value from the color field.

enter image description here

Note: when I change the "color" value in the attribute table, the attribute table doesn't display the updated "color_code" value unless I close the table and re-open it. This is a long-standing bug in QGIS.

You can also see the raw value for each feature labeling features with the value-mapped field.

enter image description here

  • Thanks for that one. Until now my workaround was to leave the widdget as it is and label the object with the desired field. – loopo Feb 16 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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