Can you use two different aggregate models in one chart?

edited June 25, 2020 in Questions
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. 


Comments

  • Pat VachonPat Vachon 💎💎💎
    edited June 25, 2020
    Hmmm ... should be possible. May need to hack the solution via the XML of the page.
  • edited October 26, 2017
    Any idea what that might look like? I have not a clue
  • Pat VachonPat Vachon 💎💎💎
    edited October 26, 2017
    Sorry. I'm slammed atm. :/
  • edited May 27, 2019
    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.
  • Rob HatchRob Hatch 🛠️ 
    edited May 28, 2019
    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>
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!