AnsweredAssumed Answered

Very strange problem with Query Task - anyone got any suggestion?

Question asked by ArielLo on Jul 16, 2013
Latest reply on Jul 22, 2013 by ArielLo

I'm having a very, very strange problem with a query task.

The problem is this.

I'm performing a query on a specific layer in local map service (local MPK).

Following the "Querying the Map" page in "Concepts" which can be found here:

The .Url attribute of a Query Task is usually composed as following:
"_mapService.UrlMapService & /" + the number of the specific layer (using a zero-based indexing).

So, if for example, I would like to make a query on the third layer in the MPK, I would write something like:

queryTask.Url = _mapService.UrlMapService & "/2"

However, this is where I have a problem. In some MPK, this works fine. In other MPKs, I need to add "+1" to get the third layer, so actually the syntax is:
queryTask.Url = _mapService.UrlMapService & "/3"

to query the third layer!

I am really clueless as to why this happens, I tried to move the layer to be the first one, then changed the code to:
queryTask.Url = _mapService.UrlMapService & "/0"

And still, I had to change it to "/1" for those MPKs.

I wrote here the differences between the MXD which worked normally and the one where I had to add +1 to the Url.

The weird ones that didn't work had:
Topology layer which was not shown in the ArcGIS Runtime map object
Archived layer which was shown in the ArcGIS Runtime map object

I removed both of these layers as I thought perhaps they cause some problem with the numbering, yet the problem persist.
I disabled archiving all together on the geodatabase, yet the problem persist.

Anyone has any idea why this problem might happen?

Any idea will be much appreciated!