<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcGIS 10.1 - groupByFieldsForStatistics fields with null values in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/arcgis-10-1-groupbyfieldsforstatistics-fields-with/m-p/292976#M1441</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have another question related to the new statistics abilities when querying features through the REST API in 10.1.&amp;nbsp; It seems that if I use a field to group the resulting statistics values, and if any records in the feature layer or table contain null values in the specified field, I get a valid-looking response, but with an empty 'features' value.&amp;nbsp; When no values are null, here's an example of what the response looks like when I ask for the stats to be grouped by a column named "integer_attribute":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;{
 "displayFieldName": "",
 "fieldAliases": {
&amp;nbsp; "integer_attribute": "integer_attribute",
&amp;nbsp; "total": "total"
 },
 "fields": [
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "name": "integer_attribute",
&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeOID",
&amp;nbsp;&amp;nbsp; "alias": "integer_attribute"
&amp;nbsp; },
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "name": "total",
&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeDouble",
&amp;nbsp;&amp;nbsp; "alias": "total"
&amp;nbsp; }
 ],
 "features": [
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "attributes": {
&amp;nbsp;&amp;nbsp;&amp;nbsp; "integer_attribute": 0,
&amp;nbsp;&amp;nbsp;&amp;nbsp; "total": 8659
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; },
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "attributes": {
&amp;nbsp;&amp;nbsp;&amp;nbsp; "integer_attribute": 1,
&amp;nbsp;&amp;nbsp;&amp;nbsp; "total": 7639
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
 ]
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, if any of the records contain a null value for the "integer_attribute", I get the following response:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;{
 "displayFieldName": "",
 "fieldAliases": {
&amp;nbsp; "integer_attribute": "integer_attribute",
&amp;nbsp; "total": "total"
 },
 "fields": [
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "name": "integer_attribute",
&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeOID",
&amp;nbsp;&amp;nbsp; "alias": "integer_attribute"
&amp;nbsp; },
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "name": "total",
&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeDouble",
&amp;nbsp;&amp;nbsp; "alias": "total"
&amp;nbsp; }
 ],
 "features": [
 
 ]
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this an outcome I should have expected?&amp;nbsp; I was hoping that the result would look more like the first response, but with a third entry that contains the count of records where the integer_attribute is null.&amp;nbsp; However, if this operation is not allowed when the group-by field contains null values, it would be helpful to get some kind of error that indicates what went wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I add a where clause to the query that excludes null values, I'll get results again...so I can still get results for non-null records as long as I do that.&amp;nbsp; However, it would be helpful if I actually could get the total null values, because no data is also a valid type of information (i.e., it helps to reveal information that is not yet known or incomplete).&amp;nbsp; The only workaround I can think of is to request the total statistics (un-grouped) separately, then get the grouped stats for the non-null records...then I'd have to loop through the results and subtract the totals from the un-grouped total...with the remainder being the number of null results.&amp;nbsp; Can anyone suggest a better approach?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Apr 2012 12:50:16 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2012-04-20T12:50:16Z</dc:date>
    <item>
      <title>ArcGIS 10.1 - groupByFieldsForStatistics fields with null values</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/arcgis-10-1-groupbyfieldsforstatistics-fields-with/m-p/292976#M1441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have another question related to the new statistics abilities when querying features through the REST API in 10.1.&amp;nbsp; It seems that if I use a field to group the resulting statistics values, and if any records in the feature layer or table contain null values in the specified field, I get a valid-looking response, but with an empty 'features' value.&amp;nbsp; When no values are null, here's an example of what the response looks like when I ask for the stats to be grouped by a column named "integer_attribute":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;{
 "displayFieldName": "",
 "fieldAliases": {
&amp;nbsp; "integer_attribute": "integer_attribute",
&amp;nbsp; "total": "total"
 },
 "fields": [
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "name": "integer_attribute",
&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeOID",
&amp;nbsp;&amp;nbsp; "alias": "integer_attribute"
&amp;nbsp; },
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "name": "total",
&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeDouble",
&amp;nbsp;&amp;nbsp; "alias": "total"
&amp;nbsp; }
 ],
 "features": [
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "attributes": {
&amp;nbsp;&amp;nbsp;&amp;nbsp; "integer_attribute": 0,
&amp;nbsp;&amp;nbsp;&amp;nbsp; "total": 8659
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; },
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "attributes": {
&amp;nbsp;&amp;nbsp;&amp;nbsp; "integer_attribute": 1,
&amp;nbsp;&amp;nbsp;&amp;nbsp; "total": 7639
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
 ]
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, if any of the records contain a null value for the "integer_attribute", I get the following response:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;{
 "displayFieldName": "",
 "fieldAliases": {
&amp;nbsp; "integer_attribute": "integer_attribute",
&amp;nbsp; "total": "total"
 },
 "fields": [
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "name": "integer_attribute",
&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeOID",
&amp;nbsp;&amp;nbsp; "alias": "integer_attribute"
&amp;nbsp; },
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; "name": "total",
&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeDouble",
&amp;nbsp;&amp;nbsp; "alias": "total"
&amp;nbsp; }
 ],
 "features": [
 
 ]
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this an outcome I should have expected?&amp;nbsp; I was hoping that the result would look more like the first response, but with a third entry that contains the count of records where the integer_attribute is null.&amp;nbsp; However, if this operation is not allowed when the group-by field contains null values, it would be helpful to get some kind of error that indicates what went wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I add a where clause to the query that excludes null values, I'll get results again...so I can still get results for non-null records as long as I do that.&amp;nbsp; However, it would be helpful if I actually could get the total null values, because no data is also a valid type of information (i.e., it helps to reveal information that is not yet known or incomplete).&amp;nbsp; The only workaround I can think of is to request the total statistics (un-grouped) separately, then get the grouped stats for the non-null records...then I'd have to loop through the results and subtract the totals from the un-grouped total...with the remainder being the number of null results.&amp;nbsp; Can anyone suggest a better approach?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 12:50:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/arcgis-10-1-groupbyfieldsforstatistics-fields-with/m-p/292976#M1441</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2012-04-20T12:50:16Z</dc:date>
    </item>
  </channel>
</rss>

