Bug report #13235

shapefile attribute of type double reverts to integer

Added by Jochen Albrecht almost 9 years ago. Updated almost 9 years ago.

Affected QGIS version:2.8.2 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:No Copied to github as #:21296


I have a basic QGIS problem that some of my students encountered in spring (version 2.6) but now hits me as well (version 2.8).
When I try to either convert a string attribute to double or when I just try to calculate a rate by dividing two integer variables in by shapefile table, the result initially is displayed correctly but when I then save the edits, the column automatically reverts to integer.
This happened to me now with different shapefiles before or after a join tables operation.
If I explicitly create an empty new column of type double and save it, it gets indeed saved as double (quitting QGIS, restarting and reloading the file). But even then, when I use the field calculator to recalculate the values of that double field, the results initially show as floating point values but after a screen refresh show only as whole numbers - although now the filed type remains double.
I have not found anything on the web that suggests that others ran into such a problem - other than my students from this spring that is.
Since Excel doesn't deal with dBase files, I now resort for myself to working on the dBase part of the shapefile in LibreOffice - but this is not a tenable solution for beginning students once our semester starts this September.

UtilCutoffByZIP.zip - I am attaching a sample shapefile where I am trying to calculate a new variable that is the per capita rate of utility cutoffs (dividing the last two columns by each other) (296 KB) Jochen Albrecht, 2015-08-19 11:56 AM

Screenshot_2015-08-21_20.49.08.png (42.5 KB) Anita Graser, 2015-08-21 11:49 AM

Related issues

Related to QGIS Application - Bug report #5153: Unexpected rounding in field calculator (documentation ne... Closed 2012-03-10


#1 Updated by Anita Graser almost 9 years ago

Works for me. Please check the attached screenshot for the settings.

Also available in: Atom PDF