Can you use two different aggregate models in one chart?

  • 1
  • Question
  • Updated 4 weeks ago
  • Answered
  • (Edited)
Hi Community,

I am wondering if it is possible to use two or more different aggregate models on the same chart as drill downs? 

Example:
Chart 1 uses an account aggregate model and I'd like to drill down to Chart 2 which uses a contact aggregate model. The context parameters don't see to be carrying over to chart 2. I get the "No data to display" error. 
Photo of Josef Lagorio

Josef Lagorio

  • 3,260 Points 3k badge 2x thumb

Posted 2 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 43,156 Points 20k badge 2x thumb
Hmmm ... should be possible. May need to hack the solution via the XML of the page.
Photo of Josef Lagorio

Josef Lagorio

  • 3,260 Points 3k badge 2x thumb
Any idea what that might look like? I have not a clue
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 43,156 Points 20k badge 2x thumb
Sorry. I'm slammed atm. :/
Photo of srikanth pasupuleti

srikanth pasupuleti

  • 192 Points 100 badge 2x thumb
Hi Josef,
Have you ever found a solution for this? I have a similar requirement to show line chart for two different aggregate models but couldn't find a way to do it. Any help is appreciated.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,678 Points 20k badge 2x thumb
This is definitely feasible,  and no need to dig into the XML to monkey with context.  The key issue is that you don't use Context to isolate on the rows to be shown in the drill down chart because its also an aggregate and likely doesn't have rows that correspond with the aggregations from the first chart.  Instead - your drill down actions need to send the value of the point - using {{$Chart.point.name}} merge notation - into a condition on the drilldown model, and then requery that model before exposing the drill down chart. 

I've built a simple Account and contact aggregation chart page for you.  It should be a good basis for your further exploration. 


<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true">
<models>
<model id="AccountAgg" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Account" type="aggregate">
<fields>
<field id="Id" name="countId" function="COUNT"/>
</fields>
<conditions/>
<actions/>
<groupby method="simple">
<field id="Type" name="type"/>
</groupby>
</model>
<model id="ContactAgg" query="false" createrowifnonefound="false" datasource="salesforce" sobject="Contact" type="aggregate">
<fields>
<field id="Id" name="countId" function="COUNT"/>
</fields>
<conditions>
<condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Account.Type" state="filterableoff" inactive="true" name="Account.Type"/>
</conditions>
<actions/>
<groupby method="simple">
<field id="MailingState" name="mailingState"/>
</groupby>
</model>
</models>
<components>
<skuidvis__chartset>
<charts>
<skuidvis__chart model="AccountAgg" maintitle="{{Model.labelPlural}}" type="column" uniqueid="sk-3_eo-111">
<dataaxes>
<axis id="axis1"/>
</dataaxes>
<categoryaxes>
<axis id="categories" categorytype="field" field="type"/>
</categoryaxes>
<serieslist>
<series valuefield="countId" splittype="none">
<actions>
<action type="setCondition" model="ContactAgg" condition="Account.Type" value="{{$Chart.point.name}}"/>
<action type="requeryModel" model="ContactAgg" behavior="standard"/>
<action type="drilldown" chartid="sk-3_fF-163">
<conditions/>
</action>
</actions>
</series>
</serieslist>
<colors/>
<legend layout="horizontal" halign="center" valign="bottom"/>
</skuidvis__chart>
<skuidvis__chart model="ContactAgg" maintitle="{{Model.labelPlural}}" type="column" uniqueid="sk-3_fF-163">
<dataaxes>
<axis id="axis1"/>
</dataaxes>
<categoryaxes>
<axis id="categories" categorytype="field" field="mailingState"/>
</categoryaxes>
<serieslist>
<series valuefield="countId" splittype="none"/>
</serieslist>
<colors/>
<legend layout="horizontal" halign="center" valign="bottom"/>
<renderconditions logictype="and"/>
</skuidvis__chart>
</charts>
</skuidvis__chartset>
</components>
<resources>
<labels/>
<javascript/>
<css/>
<actionsequences uniqueid="sk-3_ej-97"/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>