# Convert Double to Integer (Arcade)

1474
19
09-28-2020 09:03 AM
Occasional Contributor II

I am trying to do something that is probably simple, but in reviewing the Arcade functions, I didn't find the one that will do this.  I created a new field as an integer, and I now want to move contents of another field into it using calculate field.   The other field is a double field type (even though all should be whole numbers).

Tags (2)
1 Solution

Accepted Solutions
Esri Esteemed Contributor

Hi syvertson ,

The error is telling you that you can't write the value "14000002735000" from a double field (storable range -2.2E308 to 1.8E308) to a long field that will only be able to hold values in the range from -2,147,483,648 to 2,147,483,647.

19 Replies
Esri Frequent Contributor

Matthew - yes, you can do this with a simple Field Calculation using Arcade.  In my graphic below, I have two fields Double (populated) and Integer (short integer type).  I right clicked on the Int field, selected Calculate Field, and calculated the Integer field using \$featue.Double (these are just my field names is all).

Hope this helps!

Occasional Contributor II

OK.;  This is exactly what I was trying to do.  It must be something else going on.  Here are some screen shots:

What I am trying to do:

Table structure:

Error messages:

Esri Esteemed Contributor

Hi syvertson ,

The error is telling you that you can't write the value "14000002735000" from a double field (storable range -2.2E308 to 1.8E308) to a long field that will only be able to hold values in the range from -2,147,483,648 to 2,147,483,647.

Occasional Contributor II

Thanks Xander.  I understand now, but I would then need to find a different way to handle the problem I was trying to solve.  For some reason when I am storing  50290115605026 in the double field, ArcGIS Pro is adding extra digits behind the decimal point.  See below:

How do I tell the database that I need to store only whole numbers that are larger than a "long" integer?

MVP Esteemed Contributor

That's a problem for Parcels; our county uses a 14 character text string for them instead of making them numeric. Is there a specific reason you need them as a numeric?  Double, long int, or otherwise?

can't wait to retire....
Occasional Contributor II

Yes.  I have to be able to link to a database that uses this format, which is exactly the reason why it is a problem when you start adding digits behind the decimal point.

Esri Esteemed Contributor

What kind of link are you using to connect to the database? Maybe it is possible to correct the issue on the fly when linking to the other database.

I agree with jborgion that if is common to use text for this type of identifier if you can't store it in a long field and you will not apply any numeric calculations on it.

Occasional Contributor II

The database is a sql database and the format of that filed is numeric 14 characters and no decimal.  See below.  Every table that is in this database uses the same format for parcel number.  I never once had an issue with this in ArcMap.  Even though I used double for the field type in the spatial databases, they always respected the format of no decimal point.

A better question that I have is "Why would the parcel dataset EVER need to add digits behind the decimal point?

Thanks for all of this help.  I really do like the parcel fabric, and ArcGIS Pro, but I am always running into little "gotchas" like this that just cannot be explained.

MVP Esteemed Contributor

Take a look at ArcGIS field data types—ArcGIS Pro | Documentation .  You might try adjusting the precision and/or scale for your PIN field, although that's just a WAG (wild a\$\$ guess) on my part.

can't wait to retire....