Wed, 12/01/2021 - 05:28 By Pham Ba Son

Aggregate using XrmToolBox FetchXml Builder

Since the introduction of Dataverse, many utilities has been added to us developers' arsenal. One of them is the ability to use aggregate function with FetchXml. This eliminates the need to invoke LINQ operation or manual iteration in certain situations.

FetchXml now supports these following operations:

  • Sum
  • Average
  • Min
  • Max
  • Count

On top of those, Group By and Multiple Aggregation is also available (works on datetime field as well). This makes query using FetchXml becomes more versatile.

To ensure query performance, queries that return aggregate values are limited to 50000 records. Working with a sizable tables will need to be well designed.

Aggregate query in FetchXml Builder

FetchXml Builder is a very handy tool offered by XrmToolBox used by many developer to build fetchXml querry. Select aggregate option for the root level of the querry enables aggregate on entity's attribute.

Aggregate using XrmToolBox FetchXml Builder

Settings options on attribute level

Aggregate using XrmToolBox FetchXml Builder

Possible attribute aggregation

Aggregate using XrmToolBox FetchXml Builder

Aggregate using XrmToolBox FetchXml Builder

Tags

Add new comment

Image CAPTCHA
Enter the characters shown in the image.