Select to view content in your preferred language

Query Count Not The Same As From ArcMap

3272
3
08-29-2011 06:16 PM
RyanCoodey
Frequent Contributor
The map I am publishing has a layer with a definition query, In ArcMap the attribute table for this layer says it has 9154 rows... but if I run a query against this same layer after publishing this same map as an MSD to ArcGIS Server 10 SP2, with the where set to "1=1", I get 12472 rows... why aren???t these counts the same?  Same map querying the same source!!!

My WPF app has a FeatureLayer that is returning this same count of 12472, which lead me to find that the REST query does the same.

Thanks a lot for any help!

*UPDATE*
A few things I have found, maybe it is something I am not understanding about ArcMap
- Querying the SQL Server SDE View directly with the same query, there are indeed 12472 records.
- If I set the symbology from single to unique values, and hit the count column, i get 12472.
- If I select all features in the layer I get 9154.
- As mentioned earlier, the attribute table is 9154.

Does this maybe have something to do with the SDE View being one to many?  I tried finding the count of duplicate joins in the view, and that makes the count close, but still not quite the same.  If this is the case, maybe I need to find out how to do one to many joins in an SDE view properly... still odd that Server is different than ArcMap though.
0 Kudos
3 Replies
TanuHoque
Esri Regular Contributor
Can you check whether 'SQL Server SDE View' has a column whose value uniquely identifies each row in the result?
0 Kudos
RyanCoodey
Frequent Contributor
Can you check whether 'SQL Server SDE View' has a column whose value uniquely identifies each row in the result?



Tanu, thanks a lot for that info.  I eventually had figured this problem out, sorry, should have posted back... the problem was just as you said.  The views unique column was set to the Object Id, which in this case was not unique.  I didn't know at the time that you could register a different column as being the unique one, so once I ran the SDE command "sdetable -o alter_reg" to change this, it worked great.

So my assumption is that ArcMap uses this unique column, where ArcGIS Server does not.

Thanks a lot for the help!
0 Kudos
TanuHoque
Esri Regular Contributor
Randy, I'm glad that you found the solution.

So my assumption is that ArcMap uses this unique column, where ArcGIS Server does not.

This is not correct assumption. OID field strongly recommended; otherwise you may see some unexpected behaviors. That's true across all products -- Desktop, Server etc.

Attribute Table in ArcMap will display only one record per ObjectID.
On server, even though you get total count correct, something like Query by IDs may not return expected result.

Thanks.
0 Kudos