Bug report #7554
field calculator save wrong values when field width isn't enough
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||end of life|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||16496|
Using the field calculator from the attribute table, the $area of each feature is shown in the table as float (whether the result asked for is integer or decimal). If the size of the target field is less than 10 decimal places plus decimal point plus the actual maximum number of digits plus at least one to spare, the values are replaced by NULL on save.
The best resolution would be to use internal working space for the float rather than the shape file attribute table space so valid results would be saved as expected i.e. 6 digit results would fit into a 6 width integer field.
Another option might be to not allow the field width to be decreased below the minimum required for results to be saved.
#2 Updated by Giovanni Manghi almost 6 years ago
- Affected QGIS version changed from 1.8.0 to master
- OS version deleted (
- Operating System deleted (
- Target version set to Version 2.4
- Subject changed from field calculator NULLs valid values to field calculator save wrong values when field width isn't enough
it seems that now it is slightly different but always wrong:
no NULL values are saved into the table, but instead the integer part of results get truncated and the decimal part become all 0.
#5 Updated by Giovanni Manghi about 1 year ago
- Status changed from Open to Closed
- Resolution set to end of life
End of life notice: QGIS 2.18 LTR