Saturday, 16 April 2016

Max Aggregate - FetchXML Query

Max aggregate returns the maximum value in a specified column.
Null values are not considered when Microsoft Dynamics CRM computes the maximum of data. However, zero (0) is used.
The following FetchXML shows how to get the maximum value from estimated column of opportunity entity.
  1. <fetch distinct='false' mapping='logical' aggregate='true'>
  2. <entity name='opportunity'>
  3. <attribute name='estimatedvalue' alias='estimatedvalue_max' aggregate='max' />
  4. </entity>
  5. </fetch>
Explanation
To get maximum value from a column set:
  • Set aggregate to true in fetch node.
  • Set aggregate to max in aggregate attribute.
- See more at: http://msxrmtools.com/fetchxml/reference

No comments:

Post a Comment