Saturday, 16 April 2016

Count Aggregate - FetchXML Query

The following FetchXML counts opportunity records
  1. <fetch distinct='false' mapping='logical' aggregate='true'>
  2. <entity name='opportunity'>
  3. <attribute name='name' alias='opportunity_count' aggregate='count'/>
  4. </entity>
  5. </fetch>
Explanation
To calculate count set following:
  • Set aggregate to true in <fetch> clause.
    <fetch distinct='false' mapping='logical' aggregate='true'> 
  • In <aggregate> attribute set aggregate to count
    <attribute name='name' alias='opportunity_count' aggregate='count'/>  
- See more at: http://msxrmtools.com/fetchxml/reference

No comments:

Post a Comment