web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

View with aggregate function

(0) ShareShare
ReportReport
Posted on by 170

I am trying to develop a view for a list of courses that also shows a sum on the number of participants booked across all bookings - below is a copy of of the saved query xml for the entity. 

Whenever I try to display the view I get a generic error message

Any help would be very much appreciated!!

<savedquery>

            <IsCustomizable>1</IsCustomizable>

            <CanBeDeleted>0</CanBeDeleted>

            <isquickfindquery>0</isquickfindquery>

            <isprivate>0</isprivate>

            <isdefault>0</isdefault>

            <returnedtypecode>10018</returnedtypecode>

            <savedqueryid>{526eaa94-06f9-41fc-b575-6be319863651}</savedqueryid>

            <layoutxml>

              <grid name="resultset" object="10018" jump="subject" select="1" icon="1" preview="1">

                <row name="result" id="activityid">

                  <cell name="subject" width="300" />

                  <cell name="statuscode" width="100" />

                  <cell name="new_course" width="100" />

                  <cell name="ownerid" width="100" />

                  <cell name="new_coursebooking.new_participantsbooked" width="100" />

                </row>

              </grid>

            </layoutxml>

            <querytype>0</querytype>

            <fetchxml>

 <fetch version="1.0" mapping="logical" distinct="false" aggregate="true">

<entity name="new_courseinstance">

<attribute name="subject" groupby="true" alias="subject" />

<attribute name="statuscode" groupby="true" alias="statuscode" />

<attribute name="ownerid" groupby="true" alias="ownerid" />

<attribute name="new_course" groupby="true" alias="new_course" />

<attribute name="activityid" groupby="true" alias="activityid1" />                 

<link-entity name="new_coursebooking" from="new_course" to="activityid" alias="new_coursebooking1" link-type="outer">

<attribute name="new_participantsbooked" aggregate="sum" alias="bookingsum" />

</link-entity>

<order alias="subject" descending="false" />

<filter type="and">

<condition attribute="statecode" operator="not-null" />

</filter>

</entity>

 </fetch>

            </fetchxml>

            <LocalizedNames>

              <LocalizedName description="All Courses" languagecode="1033" />

            </LocalizedNames>

          </savedquery>

*This post is locked for comments

I have the same question (0)
  • AaronRic Profile Picture
    10,035 on at
    RE: View with aggregate function

    Is this still an open question or were you able to find an answer?

  • Jonathon Alsop Profile Picture
    170 on at
    RE: View with aggregate function

    No - would still love some help as I have a list view of an entity which contains a field that is a sum of sub entities. However this is currently summed using javascript on the entity form which is not updated until that form is saved which doesn't happen very often so my list view is often out of date.

    E.g. say I wanted to view a list of customers and one of the columns on that list was the sum of their total open opportunities - how do I add that to the list view??

  • AaronRic Profile Picture
    10,035 on at
    RE: View with aggregate function

    It sounds like it may be best to use a plugin to update this total field asynchronously. Or you could also try an onload script that updates this field instead of onsave.

  • multiguy Profile Picture
    465 on at
    RE: View with aggregate function

    I'd like to do something similar. I'd like to show, in a Lead View, the total number of times any email associated with that Lead has been opened.  I would be fine with showing the number of email records that have been opened, regardless of how many times they were opened. Is this possible?

  • Suggested answer
    Deepesh161 Profile Picture
    6,317 on at
    RE: View with aggregate function

    Aggregation is more of a concept on fetchxml and not views.

    IF you want to achieve aggregated columns, out of box views is not the option. Call your fetchxml in html webresource, generate a dynamic table/use jquery grids to show your data.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans