ArcGIS online converting Strings to Date

390
4
09-27-2022 10:02 AM
Oliver_Burdekin
Occasional Contributor II

I have an asset ID field that is a String. The values are unique.  Sometimes the values take the form 1-2017-10. Despite being a String when I publish this layer as a Hosted Feature Layer and view the attribute table anything that looks like a date is formatted as a date (e.g. 1/10/2017 12:00:00 AM).

How can I prevent this from happening? 

0 Kudos
4 Replies
MCameron
Esri Contributor

Hi @Oliver_Burdekin 

I have tried to reproduce this issue, but unfortunately, I am not experiencing the same behaviour. If the data is not sensitive, could you share a sample of it with me? 

 

If not, could you confirm by reviewing the Fields of the layer within ArcGIS Pro, if the Asset ID Data Type is "Text"? E.g.: 

MCameron_0-1664361402039.png


Please do keep me in the loop and I will be happy to help further. 

0 Kudos
Oliver_Burdekin
Occasional Contributor II

Thanks for the reply. The data is coming from a GeoJson. I've then published it as a hosted feature layer. If I bring that hosted feature layer into ArcGIS pro the Data Type is indeed Text. However, when I view the data in ArcGIS online (and in Pro) the example 1-2017-10 and those like it are converted to date format. I should add that viewing the data type in ArcGIS online it still states a String.

0 Kudos
MCameron
Esri Contributor

Hi Oliver, 

I have tried testing this same process with a GeoJSON file also, and I am still unable to replicate the same behaviour. I have seen issues previously, where publishing a GeoJSON as a feature layer, but with a string field where an integer is the first record (followed by alphanumeric values), which doesn't sound the same as this scenario.

In terms of your data, could you please share:

  • Do all records have AssetIDs that follow the format N-NNNN-NN (where N is a number)? Or are there a mixture of formats that are alpha-numeric, but only the records with the above formats are affected?
  • If in your GeoJSON file, the AssetID field is within the Properties section of the code?
  • Lastly, could you try running the JSON to Features tool in ArcGIS Pro, then publish the Features to ArcGIS Online and see if the same behaviour persists? 
0 Kudos
Oliver_Burdekin
Occasional Contributor II

In answer to your questions:

  • All records are numeric. Most follow the NNNNNN format with only a few following N-NNNN-NN
  • Yes the AssetID field is in the Properties section of the GeoJson and defined as a "string"
  • Converting to a feature class prior to publishing is not compatible with my workflow. However, JSONtoFeatures tool produces a feature class respecting the original settings (i.e. no conversion to date format). The attribute table in Map Viewer online is also respecting the original data.

From this it would seem the problem lies with uploading a GeoJson to AGOL and then publishing it as a feature layer. Why would that process auto format values? And are there any settings that could be changed to prevent it happening?

0 Kudos