Select by Attribute on Float values not returning any record

5415
3
Jump to solution
02-23-2015 02:26 AM
JayantaPoddar
MVP Esteemed Contributor

Hello guys,

Recently I have been facing an issue.

I have a shapefile. In its attribute table, I have a field (Float datatype).

When I use select by attribute for a floating point (e.g. <Field_Name = <Value>), no records are returned (snapshot attached).

Image1.png

This issue is occurring with the values with decimal values.

Adding those values into a text field is a workaround, but I want to understand what's causing this issue?

I am using ArcGIS 10.2 for Desktop Basic. Windows 7 Ent. SP1.

Any Help?

Thanks,

Jay



Think Location
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

three things to check

1  are you typing the expression or selecting, the field name, the operand and then the value?

2  what about type Double, you said type Float which I never use so I can't confirm whether that is an issue

3  does the > or < operand work?

View solution in original post

3 Replies
DanPatterson_Retired
MVP Emeritus

three things to check

1  are you typing the expression or selecting, the field name, the operand and then the value?

2  what about type Double, you said type Float which I never use so I can't confirm whether that is an issue

3  does the > or < operand work?

JayantaPoddar
MVP Esteemed Contributor

Hi Dan,

Thanks for replying.

1. Tried both typing the values as well as selecting the expression. Didn't work out.

2. Converting it to decimal has worked, but with certain workaround.

After creating a new Field (Double Datatype), I used Field Calculator, which gave me the following values

image 3.png

Selecting by Attribute with the value 3.1 doen't work here. So I used the expression by clicking the value in Get Unique Values.

After the selection is done, I used Field Calculator on the selected records, and just typed 3.1 on it.

Now, If I type the value 3.1 in the expression, the records get selected. However Clicking on Get Unique Value gives a value (See snapshot)

image2.png

But, if I manually enter 3.1, it still works.

3. And > < works on the float value, but nor the = sign.

So thanks a lot. Don't know that's the issue with Float.



Think Location
0 Kudos
VinceAngelo
Esri Esteemed Contributor

This is a floating point comparison issue.  It is NOT POSSIBLE to test equivalence on some values.  This is just the way binary computers (and IEEE floating-point representation) work.

Rather than testing any float value for equivalence, you must either test a range:

      var > (value - threshold) AND var < (value + threshold)

or

      abs(var - value) < threshold

or you must scale and convert to integer (which probably isn't an option in this particular use case).

- V