Convert String to Double in Portal?

782
4
09-16-2021 07:59 AM
Labels (2)
mofree
by
New Contributor II

I have a field that was very clearly a Double, was set as numeric, but was brought into the Portal as a String (edit: via an Excel Spreadsheet, for an ad-hoc product). This happens all the time, and if you don't catch it immediately and change it in the dialog box, you're out of luck. Now, I am trying to sort Descending using this field, and it is sorting it as a String, so the largest numbers are not in fact at the top of the list, not to mention that I cannot calculate based on this field. I am not at the position to reupload the layer.

I tried to Add Field (Double) and Calculate, and while it verifies the expression (just a field1 = field2, but I have tried others) it gives an error after I press calculate.

Is this not an innate function within Portal? 

0 Kudos
4 Replies
RobertBorchert
Frequent Contributor III

Quite possibly something wrong with your underlying data or your technique for loading it. 

Just to verify, look at the properties for the Table in Catalog and verify that the field is indeed a Double in the data type.

 

RobertBorchert_0-1632234174707.png

 

0 Kudos
mofree
by
New Contributor II

It was brought into the Portal as an Excel, not from an Esri source. It was a numeric value, sorted with a numeric value in the first row of the column. This is a frequent issue with the Portal, it is not new, and it is not user error.

 

And while I appreciate you double checking, that doesn't answer my question, unfortunately. I need to know, once something is already in the Portal, can you convert from String to Double?

0 Kudos
RobertBorchert
Frequent Contributor III

No you cannot convert it from string to double.  When you checked the Date Type did it also show that the length of the string was also several million long?

when you want to bring Excel Spreadsheets directly into a database your best option is to create the table in your database and then load the data.

0 Kudos
mofree
by
New Contributor II

I think there is some confusion here. I am not talking about bringing an Excel spreadsheet into a database. I am aware of capabilities related to that. The scenario is: an Excel spreadsheet brought into the Portal using Add Item for an ad-hoc purpose where the fields are read incorrectly re: String vs. Double and not caught during the upload. This happened as a direct upload to the Portal. Neither ArcMap nor Catalog nor Pro were involved in this process, and they wouldn't be in the future.

 

If those were involved, I would have the option to convert from a String to a Double (https://support.esri.com/en/technical-article/000002287). I would really appreciate replies that relate directly to the scenario at hand. But since you have stated that is not a capability within Portal, I suppose the point is mute.

0 Kudos