Quantcast
Channel: Forums - ArcGIS for Desktop - General
Viewing all articles
Browse latest Browse all 2328

Field Calculator returns 0 when decimal expected

$
0
0
I am having a problem with field calculator where it is returning 0 values instead of the calculated answer.

Here is an overview of the problem: I am trying to do a in field calculator, where I'm trying to populate a new field with the values from a fairly simple equation of one field divided by another (Cnt1 by Pop1 in this case).

Below are two screenshots that show the fields with field properties, and another showing the field calculator and the equation with the "answer" field populated by 0s.


Attachment 23277


Attachment 23278


Both fields that I am dividing are double, and the value, while small is not infinitesimal, approx 0.01765 (as calculated with an actual calculator).

I have tried creating various types of new fields: double, long, float, and played around with the scale/precision/properties, but everytime it returns "0" values. I know the values will be very small, i.e .04 but it doesn't seem to be a decimal display problem as I tried running it with Pop1/.4 and it correctly returned a decimal.

I've tested dividing the Cnt1 by .5 and that gives an appropriate decimal value, so it's not the new field format; the one thing that seems really strange is when I add (in field calculator python version): !Cnt1!+!Pop1! (which is 38+218699) I get 2.187, however, I suppose this could be related to the field being classified as float with precision=4, scale=3?


I've also tried t doing:

1.0* (Cnt1/Pop1)

and also
1.0* (int(Cnt1/Pop1))
But neither works, I'm at my wits end on this one, and would greatly appreciate any help!
Attached Thumbnails
Click image for larger version

Name:	image6.jpg‎
Views:	N/A
Size:	28.8 KB
ID:	23277   Click image for larger version

Name:	image7.jpg‎
Views:	N/A
Size:	15.4 KB
ID:	23278  

Viewing all articles
Browse latest Browse all 2328

Trending Articles