Getting rid of underscore in fieldvalues popup

1069
2
06-13-2017 01:06 PM
SarojThapa1
Occasional Contributor III

Is there any quickest and easiest way to get rid of underscore in field values in popup? For example, field: value pair is

FeatureName : Hello_World. I want to make it Hello World.

I am using popup template and fieldInfos.

{fieldName: "Feature_Type", visible: true, label: "Major Feature"}
0 Kudos
2 Replies
shan_sarkar
Occasional Contributor III

Saroj,

You can handle this from the database level or service level.

Database Level: Update the alias field names in the feature class directly from ArcCatalog. For this you simply need to stop the map services for few minutes and open the feature class properties and update the alias field names available under the Field tab. You will have to re-add the layers in the map document and overwrite the existing map service.

Service level:- Provide alias fields names to each layer in the map document and overwrite the map service. This can be achieved by going into each layer's layer properties and Field tab. However, this has few drawbacks though, like if the same layer has been added over multiple times, you will have to update the alias field names multiple times and if the field names change in the database it will not reflect in the map document unless the layer has been added freshly.

Refer Modifying field properties—ArcGIS Help | ArcGIS Desktop 

I hope this helps!

-Shan


~Shan
MirHashmi
Occasional Contributor

This can also be accomplished on the client side code in java script by removing the "_" from the fields.

var str1 = "Feature_Type";
var str2 = str1.replace(/_/g, ' ');