Select to view content in your preferred language

Find Task on XY Event

1892
15
04-28-2011 09:46 AM
StephanieWidas
New Contributor III
I have XY data in SQL that I have added as an event layer to a map document.  That .mxd was then used to create a map service.  I can sucessfully use the Find Task in the REST services directory to find a specific record, but when I try to execute the find task using the Javascript API, it fails. 

I exported my data to a personal geodatabase and created a map service off of the new feature class.  The Find Task worked perfectly.  It works if the source data of the map service is a feature class, but fails if it is an XY event layer.  Can the Find Task be used on XY events or that a limitation of the task?  Perhaps it is just a syntax error when defining my find parameters?
     findParams = new esri.arcgis.gmaps.FindParameters();
     findParams.returnGeometry = true;
     findParams.layerIds = [0];
     findParams.searchFields = ["REQUESTID"];

     findParams.searchText = requestID;
     findParams.contains = true;
     findTask.execute(findParams, zoomToRecord);



Any help would be much appreciated.
Thanks!
~Stephanie
0 Kudos
15 Replies
StephanieWidas
New Contributor III
Hmm...is your endpoint publicly accessible? I'm not sure how helpful I can be w/o access to test for myself. If it's not available publicly, I would say it's time to talk to tech support.

No, this particular service is internal.  I submitted the issue to tech support this morning.  Hopefully they'll be able to figure out what's going on.
Thanks again for your help!
0 Kudos
derekswingley1
Frequent Contributor II
Good luck!
0 Kudos
StephanieWidas
New Contributor III
I worked with ESRI tech support and they concluded that the issue with the Find Task was related to the JSON output.  The find task executed from within the ArcGIS Services Directory (REST) worked because the results are returned as html by default.  The format can be changed to JSON by appending f=json to the end of the text in the address bar.  When this was appended, the JSON output failed.  The JavaScript API requires the JSON format, so that is why the find task was failing in my application.  Why this fails is still not known.  Tech support said that it looks like it is probably a bug in 9.3/9.3.1.  The problem could not be replicated in an ArcGIS Server 10 environment.  They will do further investigating.

I did some of my own troubleshooting on the find task during this past week.  I tried 3 different data sources for my XY event layer in my map service (directly from SQL Server, a .dbf, and a personal geodatabase table).  It appears that the find task works OK as long as the XY Event layer is not directly hitting a table in SQL Server.  If the SQL table is exported to a .dbf or pgdb table and that exported table is then used to create the event layer, the find task worked.

In the meantime, tech support has helped me get the Query Task to work properly.  I am able to use that instead of the Find Task in my application.  The problem I was running into with the Query Task (from the query task example in the resource center - http://help.arcgis.com/EN/webapi/javascript/gmaps/samples/querytask/query_point.html) was incorrect locations of my results on the Google map.  The results were being lined up across the top (see attachment).  There is a line of code in the example that needed to be commented out.
query.queryGeometry = bounds;
Once I took out that line, my results displayed in the correct location.

If/when I learn anything more about the Find Task from ESRI tech support, I will be sure to post an update.
0 Kudos
derekswingley1
Frequent Contributor II
Thanks for the follow-up and update! Glad you're making some progress.
0 Kudos
StephanieWidas
New Contributor III
Tech support was able to reproduce the problem and it has been logged as a bug - NIM068764.
0 Kudos
AdrianMarsden
Regular Contributor II
Tech support was able to reproduce the problem and it has been logged as a bug - NIM068764.


AAAArrrggghhhh - all afternoon I've struggled with this, just about to give up when I cam e to the conclusion the FIND didn't play nice with event layers, then I found it was a bug.  Doh!
0 Kudos