QGIS Feature Form – How to Force Attribute to Save as Uppercase

featuresqgis

For example I have feature form with colum name NAME (with names of contries).

I want that all counties names are in capital letters.

As users enter the names in lowercase, uppercase, mixed … I am setting all nemes to uppercase on this way:

attributre table -> Field calculator -> Expression ->  upper("NAME")

enter image description here

and this is working fine, but the idea is that I don't have to repeat it every time, is there any way to save ('field properties') in the project so that no matter what the user enters, it will be capitalized and saved into table.

Best Answer

The easiest way is to set up two NAME field (NAME_1 and NAME_2 for exemple). The first being directly fill by the user, the second set as "hidden" in the feature form and with a default value set to upper("NAME_1"), don't forget to check the "Apply default value on update" box.

This will give you a field with the country name in uppercase but you will also have an useless second field with the country name in mixed case...

Related Question