Saturday, 16 April 2016

Countcolumn Aggregate - FetchXML Query

Countcolumn aggregate counts records where specified column don’t have null.
In the following FetchXML opportunity count is returned where name column don’t have null values.
  1. <fetch distinct='false' mapping='logical' aggregate='true'>
  2. <entity name='opportunity'>
  3. <attribute name='name' alias='opportunity_colcount' aggregate='countcolumn'/>
  4. </entity>
  5. </fetch>
Explanation
To use countcolumn aggregate
  • Set aggregate to true in <fetch> clause.
    <fetch distinct='false' mapping='logical' aggregate='true'> 
  • Set aggregate to countcolumn in aggregate attribute.
    
    <attribute name='name' alias='opportunity_colcount' aggregate='countcolumn'/> 
- See more at: http://msxrmtools.com/fetchxml/reference

No comments:

Post a Comment