AnsweredAssumed Answered

StatisticsDefinition on Shape Length field?

Question asked by ibroad on Oct 26, 2017
Latest reply on Oct 26, 2017 by ibroad

I'm using QueryTask / Query with a StatisticsDefinition to try and get the total miles of line using the SHAPE length field, but I can't get it to work. If I remove everything but the StatisticsDefinition it works fine.

 

I'm testing using the REST page.

 

The layer I'm querying does have a join in the MXD on the published map service. So, I have to use the table prefix typically for whatever field I view.

 

Here's what I have for the StatisticsDefinition:

 

[
    {
        "statisticType": "sum",
        "onStatisticField": "SHAPE.STLength()",
        "outStatisticFieldName": "TotalMiles"
    }
]

 

Any idea what's wrong?

 

EDIT

 

I just tried:

 

[
    {
        "statisticType": "sum",
        "onStatisticField": "SERVERNAME.LAYER.SHAPE.STLength",
        "outStatisticFieldName": "TotalMiles"
    }
]

 

Because of the join in the MXD, and the query is successful, but I don't see the TotalMiles field in the results on the REST page.

 

Any ideas?

 

I checked the Server logs, and I'm seeing:

 

"General geodatabase error occured."

Which isn't too helpful.

 

EDIT

 

I'm thinking it's because of the table join in the MXD, which is too bad because I need it.

Outcomes