title: How do you correctly return an aggregate data field using AX 2012 Query Service
body: <p>I have been working on the AX Query Service as of late.  I have a pretty good understanding of everything but it seems that the QueryDataFieldMetadata object does not like aggregates.  When I build a QueryDataFieldMetadata object:</p>
  
  <pre><code>QueryDataFieldMetadata field = new QueryDataFieldMetadata();
  field.TableName = "InventSum";
  field.FieldName = "AvailPhysical";
  field.SelectionField = SelectionField.Database;
  </code></pre>
  
  <p>And add it to the data source everything is fine.  But when I do this:</p>
  
  <pre><code>QueryDataFieldMetadata field = new QueryDataFieldMetadata();
  field.TableName = "InventSum";
  field.FieldName = "AvailPhysical";
  field.SelectionField = SelectionField.Sum;
  </code></pre>
  
  <p>And add it to the data source the field is not returned at all in the results set.  I have checked the datasource itself before executing the query and it is in the fields list but nothing is returned.  Does anyone know why this might be happening?  Any help would be appreciated.</p>