Skip to main content
Nintex Community Menu Bar
Question

Question on Pie Charts with Aggregate Models

  • July 11, 2024
  • 3 replies
  • 13 views

Forum|alt.badge.img+5

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.

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"></field> </fields> <conditions></conditions> <actions></actions> <groupby method="simple"> <field id="Type" name="type"></field> </groupby> </model> </models> <components> <skuidvis __chart model="Account" maintitle="{{Model.labelPlural}}" type="pie" uniqueid="sk-2GYr0K-85"> <dataaxes> <axis id="axis1"></axis> </dataaxes> <categoryaxes> <axis id="categories" categorytype="field"></axis> </categoryaxes> <serieslist> <series valuefield="countType" splittype="field" modelid="Account" aggfunction="count" splitfield="type"></series> </serieslist> <colors></colors> <legend layout="horizontal" halign="center" valign="bottom"></legend> </skuidvis__ chart> </components> <resources> <labels></labels> <javascript></javascript> <css></css> </resources> <styles> <styleitem type="background" bgtype="none"></styleitem> </styles> </skuidpage>

This should be possible with an aggregate model, right? Hopefully I’m just missing something obvious.

Thanks in advance,
Andrew

This topic has been closed for replies.

3 replies

Forum|alt.badge.img+17

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.


Forum|alt.badge.img+5
  • Author
  • July 11, 2024

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>


Forum|alt.badge.img+17

Glad I could help!