How do you combine data.length for different models in a tab?

edited June 25, 2020 in Questions
I have a tab that has three tables with all of the same object (Cases), but different models to separate them. How do I get a total of all cases to show in the tab to let the user know there are records present? I know how to get the count for one model, but I can't figure out how to get the sum.

Thanks!

Comments

  • Pat VachonPat Vachon 💎💎💎
    edited June 25, 2020
    Short of using javascript, I'd create another model just for this purpose. That model have three conditions that with the following logic. 1 OR 2 OR 3
    Each condition would be Id "in" field model of another model field Id.
  • edited July 9, 2015
    Thanks for that answer. The conditions have changed on my end, though.

    Is it possible to get an aggregate count of records from three different objects?
  • Rob HatchRob Hatch 🛠️ 
    edited September 1, 2016
    No,  it is not possible to aggregate data from multiple sObjects. 
  • Rob HatchRob Hatch 🛠️ 
    edited September 1, 2016
    Digging for another answer and I see this question.  Things have changed!

    Make a UI only field that aggregates the length of each model together.  Something like this. 

    {{$Model.myModel1.data.length}}+{{$Model.myModel2.data.length}}

    That should get you your aggregated value to put in a tab...


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!