Select to view content in your preferred language

Convert Double to Integer (Arcade)

8690
19
Jump to solution
09-28-2020 09:03 AM
Syvertson
Frequent Contributor

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).  

0 Kudos
19 Replies
Syvertson
Frequent Contributor

Thanks Joe.  Can't find a way to update that in Pro.  In ArcMap it is a snap.  BUT, I can't alter the new parcel fabric in ArcMap, only in ArcGIS Pro.  See what I mean about all the "gotchas."

0 Kudos
JoeBorgione
MVP Emeritus

In ArcGIS Pro, right click on the feature class and choose fields. Find the field that has the PIN, and you'll see the word Numeric in the Number Format column. Click on the three dots and set 0 (zero) decimal places and then save it above.  That just changes the display, not the underlying values.

That should just about do it....
0 Kudos
Syvertson
Frequent Contributor

This doesn't help, because I am already able to display the values correctly, my problem is the storage of extra digits after the decimal.

0 Kudos
JoeBorgione
MVP Emeritus

What's the underlying database?

That should just about do it....
0 Kudos
Syvertson
Frequent Contributor

For now it is in a file based geodatabase, which is the only format that works for editing the new Parcel Database, aside from moving to enterprise, but when you do that you are forced to use editing through a feature service.

0 Kudos
JoeBorgione
MVP Emeritus

I must be missing something here, so my apologies.  I just added a double type field (PIN) to a feature class in a fgdb. I then entered this number: 

43430000100000

to one of the records in that field.  I'm not seeing any decimal values:

That should just about do it....
0 Kudos
Syvertson
Frequent Contributor

It does not happen all the time.  And I can't say exactly when it decides to rear it's head.  Perhaps it is something that I do that I am unaware of, but the bottom line is that the values normally do work.  It is only every so often that the extra decimals show up, and you cant see them when it is displayed normally.  When you click on the value, it will show you then the extra decimals.  

I am just going to close this out and realize this is just a "feature" that I will learn to deal with.  If this ever becomes more problematic than it is, I will pursue further. 

Thanks for attempting to help.  

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Matthew Syvertson‌, I do think there is something wrong with either a geoprocessing tool or the Pro application.  I was able to insert 50290115605026.0 into a FGDB feature class using an Insert Cursor and it displays correctly in Pro:

How did you copy the data from the EGDB to FGDB?

JoshuaBixby
MVP Esteemed Contributor

In SQL Server, NUMERIC is an exact numeric data type, i.e., fix precision and scale.  ArcGIS doesn't natively implement a proper numeric/decimal data type.  The ArcGIS "Double" data type is based on the .NET System.Double data type, which is an approximate numeric data type.

When working in databases or data formats that implement decimal/numeric, bigint, or money/currency data types; you can have an exact 14-digit number like 50290115605026.  Unfortunately, that isn't a file geodatabase.

JoeBorgione
MVP Emeritus

How did the original sql data find it's way to the fgdb?

That should just about do it....
0 Kudos