ArcGIS online calculate in new field returns rounded whole numbers only, no decimals

309
4
Jump to solution
11-25-2020 04:06 PM
New Contributor III

Hi in a hosted table created from a uploaded csv, I have a field which contains minutes data, such as

totalminutes
30
48
50
20
25

Which was for some reason, uploaded as fieldtype string, even though I specified the fieldtype as integer when I first uploaded the csv (same also occurred when trying to specify dates as fieldtype date). 

I want to make a new field in ArcGIS online, which would contain hours data calculated from totalminutes. I've tried creating a new field with fieldtype integer and using SQL totalminutes/60. However, this only returns whole numbers like 0, 1 and 2s, which seem to be rounded numbers, rather than 0.5, 0.75 etc. 

However when I create a new string field and use the above formula, it returns correct results (0.5, 0.75 etc). I need the hours field to be a integer field though, since I need to use SUM on this field in Dashboard. Any ideas on how I can achieve this in ArcGIS onlline?

Thanks!

Reply
0 Kudos
1 Solution

Accepted Solutions
Esri Contributor

Hi @JulietK ,

 

If the totalminutes is string you will need to cast it to correct data type and then use the below to calculate

 

CAST(totalminutes AS FLOAT)/60

 

ManishPatel_0-1606355632885.png

 

Cheers,

Manish

 

______________________________________________________________________________________________

If the answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.

Cheers,
Manish

View solution in original post

4 Replies
Esri Contributor

Hi @JulietK ,

 

Have you tried using the Double instead of integer.

 

integers are numbers without decimals. double is a floating-point numbers with double precisions.

 

Hope this helps.

 

______________________________________________________________________________________________

If the answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.

Cheers,
Manish
Reply
0 Kudos
New Contributor III

Hi Manish, thank you for your response. 

Unfortunately creating a new field with fieldtype double and using the same formula still returns rounded whole numbers only. Very weird!

Reply
0 Kudos
Esri Contributor

Hi @JulietK ,

 

If the totalminutes is string you will need to cast it to correct data type and then use the below to calculate

 

CAST(totalminutes AS FLOAT)/60

 

ManishPatel_0-1606355632885.png

 

Cheers,

Manish

 

______________________________________________________________________________________________

If the answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.

Cheers,
Manish

View solution in original post

New Contributor III

Hi Manish,

That worked perfectly, thank you for your help!