Customer Service | Training | Contact Us
You are here: Home > User Forums > arcims product discussion conference > Thread Replies

ArcIMS Product Discussion Conference

ArcIMS: Java Connector JavaBeans (ArcIMS 4.x) forum

Escaping ampersand when using displayFeatur...   Jonathan Cooper May 10, 2004
Re: Escaping ampersand when using displayFe...   Zac Odom May 10, 2004
Re: Escaping ampersand when using displayFe...   Jonathan Cooper May 11, 2004
Re: Escaping ampersand when using displayFe...   Jonathan Cooper May 11, 2004
Re: Escaping ampersand when using displayFe...   Tyrone Ligon May 11, 2004
Re: Escaping ampersand when using displayFe...   Zac Odom May 11, 2004
Report Inappropriate Content • Top • Print • Reply    
Subject Escaping ampersand when using displayFeatures 
Author Jonathan Cooper 
Date May 10, 2004 
Message Hi,

when using a filter you can escape ampersands by using filter.setCheckesc(true). However, when I use the map.displayFeatures(FeatureLayer,whereExpression,zoomToFeature) method it fails if any field in my source layer contains an ampersand. I cannot see any way to escape ampersands when using displayFeatures(). Have I missed something (likely)? Or is it simply not possible to use this method to zoom to and display features if there is a special character (in this case an ampersand) in a field of the selected feature of the source layer.

Thanks, Jon 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: Escaping ampersand when using displayFeatures 
Author Zac Odom 
Date May 10, 2004 
Message can you replace it with & ? or /& or something? i am not a java guy but these have worked for me in the past.

 
  Hope this helps.

Zac Odom, CIW, MCP
GERMANY 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: Escaping ampersand when using displayFeatures 
Author Jonathan Cooper 
Date May 11, 2004 
Message Hi Zac,

Thanks for your suggestion. Yes it is possible for me to replace special characters with their equivalent codes. In fact I did this initially. But this is very inconvenient for me to do as the data are changing frequently and my import routines would have to catch all special characters in all fields before publishing to a map service. In other words I'd have to write my own escape methods - which is just a pain. Unfortunately the displayFeatures() method is 'black boxed' so you can't escape characters on the fly.

I think it is just a method (i.e. setCheckesc(boolean)) that is missing.

Cheers, Jon 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: Escaping ampersand when using displayFeatures 
Author Jonathan Cooper 
Date May 11, 2004 
Message Here is the best fix I've managed to find so far. The credit goes to Tyrone Ligon on this thread: http://forums.esri.com/Thread.asp?c=64&f=1254&t=103647&mc=3#msgid292257

Using this code I can zoom to my feature and use setCheckesc(true) to escape ampersands and other special characters. So I don't have to change my data.

Thanks Tyrone,

Jon
 
 
Filter queryZoomFilter = new Filter();
String queryZoomWhere = "STABBR_CODE = 'NY'";
queryZoomFilter.setCheckesc(true);
queryZoomFilter.setGlobalEnvelope(true);
queryZoomFilter.setWhereExpression(queryZoomWhere);
queryZoomLyr.setFilterObject(queryZoomFilter);
map.getLayers().setGeometry(true);
map.refresh();

Envelope theEnv = queryZoomLyr.getRecordset().getEnvelope(0);
map.doZoomToExtent(theEnv);

map.sendImageRequest();
map.refresh();

 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: Escaping ampersand when using displayFeatures 
Author Tyrone Ligon 
Date May 11, 2004 
Message Jon,

Happy to be able to give back, considering all the tidbits I've picked up from this forum in order to work around ArcIMS's ideosyncracies.

 
  Tyrone Ligon
 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: Escaping ampersand when using displayFeatures 
Author Zac Odom 
Date May 11, 2004 
Message that would be my approach. just create a function called clean or something and escape out the &, ', etc. i know it is a pain but if you do it in a function then it you'll only have to do it in one place and, eventually, you will get to a place where you will have them all. & and ' are usually the worst offenders.

 
  Hope this helps.

Zac Odom, CIW, MCP
GERMANY