[GIS] Decimal number changed to whole number

attribute-tablefield-calculatorqgisqgis-2.18

I am working in QGIS 2.18.0 version.

My analysis involves using vector filed calculator for some operation. This new filed I am creating with an output filed type as Decimal number(integer). I wrote expression and it works fine but when I save it the field type changes to Whole number.

Screen shot of attribute table

In above image SlopeRati was Decimal type and I created one more filed SlopeRati1 and stored orginal decimal values as STRING. After saving this later doest not change but earlier filed becomes Whole number.

Best Answer

Decimal number(integer)

Is a whole number.

You want to use:

Decimal number (real)

Also as mentioned by Joseph in the comments make sure you have a precision set. So precision is how many decimal places get saves and width is the overall number if digits stored both before and after the decimal place.

Related Question