5

New to QGIS and couldn't find anything related to this.

If I want to add a capital letter n, "N", to an attribute field QGIS does not accept it. The shapefile I am editing has 'Y' and 'N' in a text field. I have a feeling this is related to the NULL that is automatically applied to empty fields, but have no idea how to resolve.

The only way I've been able to add a capital N to a field is via the field calculator every time, which is too time consuming for the amount of editing I am doing.

  • 3
    I would like to add to this question, that I just touble tested: Seems like a capital 'N' is the only letter which does not work. All other capital letters I tried are no problem. 'n' does work as well. Tested on QGIS 3.4.2. No problems adding an 'N' in QGIS 2.18.7 though. Field length or already existing content does not matter. Probably worth opening a bug report. – MrXsquared Jan 16 at 1:22
  • which QGIS version do you use? – MrXsquared Jan 16 at 1:33
  • @MrXsquared I can replicate this bug on QGIS 3.2.3 with Qt 5.11.2. – Logan Byers Jan 16 at 2:15
  • @MrXsquared 3.2.3 – FrankR Jan 16 at 2:25
5

Tested here, in QGIS 3.4.3 (Windows system), too.

I have a feeling this is related to the NULL that is automatically applied to empty fields

I would think so, because it does not accept the words 'N', 'NU', nor 'NUL'. Take all those strings as NULL value.
However, it does accept them when creating the feature. The issue is when editing the attributes table.

but have no idea how to resolve


UPDATE:

The NULL value string can be modified in the Settings > Options... > Data Sources tab. You can set a string that you never use (or an empty string) in the Representation for NULL values option:

null-values

You will not be able to enter that string in the attribute table from the keyboard, which still seems like an error, but at least you can enter usual strings.

attribute-table-???


A provisional solution can be in the Attributes Form tab of the layer Properties.

In case you only need 'Y' or 'N' values, it seems to me that the simplest way to do it is by setting a Checkbox, in the Widget Type option.

attribtes-form

Another solution would be to choose the Vaue Map option, but it requires one more click to be established, and it is not necessary for only two possible entries (if you need to have the option to choose the NULL value, it may be more advisable).

The attribute table would look like this:

attributes-table

Of course it is just a solution for the particular case.

  • 1
    Thanks. The reason I wouldn't use the checkbox is that we have other values besides Y and N, usually 3 or more. This only is an issue for us because we use QGIS on PCs that don't get a ton of use and mostly use ESRI. If we were exclusively using QGIS we would just choose different values like lowercase y/n instead, but for consistency we want to keep the Y/N since many of our other data sources use them. – FrankR Jan 16 at 19:23

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.