Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This sample shows how to retrieve aggregate record data using FetchXML.
What this sample does
The FetchXML query is intended to be used in a scenario where it creates queries to get the data.
How this sample works
In order to simulate the scenario described in What this sample does, the sample will do the following:
Setup
- Checks for the current version of the org.
- The
CreateRequiredRecordsclass creates 3 opportunity records and account record.
Demonstrate
- The
estimatedvalue_avgfetches the average of estimatedvalue for all the opportunities. TheEntityCollectionmethod returns the results of theRetrieveMultiplerequest. - The
opportunity_countfetches the count of all opportunites. - The
estimatedvalue_maxfetches the maximum estimatedvalue of all opportunites. - The
estimatedvalue_minfetches the minimum estimatedvalue of all opportunities. - The
estimatedvalue_sumfetches the sum of estimatedvalue for all opportunities. - The
estimatedvalue_avg2fetches the multiple aggregate values within a single query. - The
groupby1fetches a list of users with a count of all the opportunites they own using the groupby. - The
byyearfetches the aggregate information about all the opportunites that have been won by year. - The
byquarterfetches the aggregate information about the opportunities that have been won by quarter. - The
bymonthfetches the aggregate information about the opportunities that have been won by month. - The
byweekfetches the aggregate information about the opportunities that have been won by week. - The
bydayfetches the aggregate information about the opportunities that have been won by day. - The
byyrqtrfetches the aggregate information about the opportunities that have been won by year and quarter. - The
byyrqtr2specifies the result order.
Clean up
Displays an option to delete all the data created in the sample. The deletion is optional in case you want to examine the data created by the sample. You can manually delete the data to achieve same results.