Skip to main content

I feel like I’m missing something obvious here…can you display an aggregation in a template field?  It works just fine if I place the aggregate field in the Field Editor but I can’t get it to display in a template.  

Any help would be greatly appreciated!

If you use it in a field editor you get the model context automatically. If you have a template outside of a field editior I think you need to specfify the model context fully. For example if you have a model aggModel with a summary aliased sumAmount,

In the field editor you could use {{sumAmount}} in a template
Outside of the field editor you could use {{$Model.aggModel.data.0.sumAmount}}





Just a slight clarification to Peter’s post: you need to use an Aggregation / Grouping field’s Alias Name in the template, for instance if your aggregation is SUM(Amount), and the alias name is sumAmount, then in the template you must say {{sumAmount}} or {{{sumAmount}}} , rather than {{Amount}} and {{{Amount}}}.


That worked!  Just for clarification, to display the aggregation in the template I formatted it as follows:

{{$Model.NewlyMatched_aggr.data.0.countNewlyMatched}}


e30350a208f0d22650cbc181bf114f5cd8be158c.png


Perfect.  I’m totally going to steal that picture. 


How can you add up all rows of an aggregate model to display in a template?  I have a dashboard working but I need to display a number in a template from an aggregate model that has groupings.

I tried to leverage this but am not at all a javascript person.


How could I add up all rows of “OppyAggregate” model’s “sumNCVIc” (alias)?


We have not exposed the API for column summaries.  Sorry.  This means the solutions discussed in the link above are really not relevant to your use case.  What I do to satisfy this requirement is create a separate aggregate model that doesn’t have the grouping for the single total number.  


Is there a way to have one table filter both models then? I’d like to have filters at the top allowing people to dig into the data in different ways and present the updated numbers.


Thanks,

Joe



Take a look at Pat’s post from a few days ago:  https://community.skuid.com/t/cross-model-linked-conditions

Does exactly what you are looking for…