Getting File Geodatabase float fields into ArcSDE database float field

935
4
02-14-2018 06:19 AM
MKF62
by
Occasional Contributor III

I'm having a lot of trouble with this and can't seem to figure it out. Ideally, I would like my ArcSDE database float field to have a precision of 3 and a scale of 2, but when I transfer values from a file geodatabase using an insert cursor, it only transfers some of the values and I'm trying to figure out why it's only choosing to transfer some values. Maybe someone can shed some light for me..

I know file geodatabases don't have precision/scale and instead just hold binary type fields. So there can be a lot of decimal places and I see this in some of my values (i.e. 1.47999921 or something like that). 

What happens when your value has a smaller scale than the field it is being transferred to? I thought that if the scale of the destination database was larger than what is being inserted, it would just put the whole number in and append a zero to the end. So if I had 44.1 as a number to be inserted, it would insert 44.10 if the scale of the destination field was 2.

If the scale of the destination database is smaller than what is being inserted, it will truncate the value and insert it.

I have roughly 10 float fields. Most of them have values that only have one decimal place, but any field has the potential to have a value with multiple decimal places as some values are calculated dynamically in the script. When I set my precision to 3 and my scale to 1, all records are inserted. When I set my precision to 3 and my scale to 2, only about half the records are inserted. Is this because many of the records only have values with one decimal place, meaning scale cannot actually "scale up"? If this is the case, then you must programmatically add a 0 at the hundredths place in the decimal if you want to maintain a scale of 2 in the destination SDE database, right?

Tags (2)
0 Kudos
4 Replies
Lake_Worth_BeachAdmin
Occasional Contributor III

can you create a new FC in SDE with the desired fields and data types, then use InsertCursor—Data Access module | ArcGIS Desktop to insert the rows respectively.

0 Kudos
MKF62
by
Occasional Contributor III

Assuming I understand your suggestion correctly, that's exactly what I am doing already and this is the problem that arises. I'm using an insert cursor to pass data from the file geodatabase to the SDE database table.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Question, do you need to have a storage of the numbers using  three digits and two decimal)? Are you using a round statement in the script? It may not truncate the value when you provide more digits than the precision allows (might just not store the result). Did you check which values are stored and which not? If you are only interested in the presentation of the data, set a numeric format in Desktop or the Web Map.

0 Kudos
Lake_Worth_BeachAdmin
Occasional Contributor III

or convert it to a string if you only want to present it and not perform calculations on it.

0 Kudos