Question on Pie Charts with Aggregate Models

edited October 2019 in Questions
I have a lot of records I need to return, so using an Aggregate Model. I'd like to load all Account records and then show a Pie Chart by Account Type. The problem I'm running into is that each Account Type is just showing 1 record instead of the aggregated total of Account Ids.

image

Here is the XML - should be a simple copy-and-paste as it is using all standard Salesforce fields.
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">      <models>          <model id="Account" limit="" query="true" createrowifnonefound="false" datasource="salesforce" type="aggregate" sobject="Account">              <fields>                  <field id="Id" name="countId" function="COUNT"/>              </fields>              <conditions/>              <actions/>              <groupby method="simple">                  <field id="Type" name="type"/>              </groupby>          </model>      </models>      <components>          <skuidvis__chart model="Account" maintitle="{{Model.labelPlural}}" type="pie" uniqueid="sk-2GYr0K-85">              <dataaxes>                  <axis id="axis1"/>              </dataaxes>              <categoryaxes>                  <axis id="categories" categorytype="field"/>              </categoryaxes>              <serieslist>                  <series valuefield="countType" splittype="field" modelId="Account" aggfunction="count" splitfield="type"/>              </serieslist>              <colors/>              <legend layout="horizontal" halign="center" valign="bottom"/>          </skuidvis__chart>      </components>      <resources>          <labels/>          <javascript/>          <css/>      </resources>      <styles>          <styleitem type="background" bgtype="none"/>      </styles>  </skuidpage>
This should be possible with an aggregate model, right? Hopefully I'm just missing something obvious.

Thanks in advance,
Andrew

Comments

  • edited October 2019
    Did you try changing the aggregate function to Sum instead of Count. I think count is just counting the rows. Sum may give you what you are expecting.
  • edited September 2017
    Yes! That worked Raymond. I knew I was just overlooking some small detail. For anyone else running into this that finds this post. Here is the XML that worked:
    <skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">      <models>          <model id="Account" limit="" query="true" createrowifnonefound="false" datasource="salesforce" type="aggregate" sobject="Account">              <fields>                  <field id="Id" name="countId" function="COUNT"/>              </fields>              <conditions/>              <actions/>              <groupby method="simple">                  <field id="Type" name="type"/>              </groupby>          </model>      </models>      <components>          <skuidvis__chart model="Account" maintitle="{{Model.labelPlural}}" type="pie" uniqueid="sk-2GYr0K-85">              <dataaxes>                  <axis id="axis1"/>              </dataaxes>              <categoryaxes>                  <axis id="categories" categorytype="field"/>              </categoryaxes>              <serieslist>                  <series valuefield="countId" splittype="field" modelId="Account" aggfunction="sum" splitfield="type"/>              </serieslist>              <colors/>              <legend layout="horizontal" halign="center" valign="bottom"/>          </skuidvis__chart>      </components>      <resources>          <labels/>          <javascript/>          <css/>      </resources>      <styles>          <styleitem type="background" bgtype="none"/>      </styles>  </skuidpage>
  • edited October 2019
    Glad I could help!
Sign In or Register to comment.