Assigning values from Column Summaries to Fields

Hi there,

This seems like it would be quite simple, but I have not been able to find a way to assign the “Sum” from a Column Summary to a Field.

In the image below, I have a custom object that tracks ‘Payments’ related to a ‘Contact’.

Ideally, I would like to assign ‘Summary A’ and ‘Summary B’ to Fields on the Contact model.

Finally, I could have a Formula Field on the Contact called ‘Payment Balance’.
‘Payment Balance’ = ‘Summary A’ (minus) ‘Summary B’

Any help or suggested alternatives would be greatly appreciated.

It will probably be easier to use a SalesForce rollup summary field to SUM the Amount Due and Amount Received. Doing it in skuid will involve a lot of JavaScript and it’s much easier to create a rollup in SF (unless you’re out of rollups). 

Thanks Moshe. I was hoping that since Skuid had the Column Summary feature built into the Table Component, that it would be relatively simple to assign that Summary to a Field Value.

I’ll try using the rollup summary field for the time-being as a work-around. Cheers.

Though the summary values are built into the table component - we do not expose them through the javascript API.   Sorry. 

No worries. The rollup summary fields work just fine as an alternative.
Thanks for all your help Rob! Greatly appreciated.

Any chance those values will be exposed anytime soon? It would be super handy! :slight_smile:

With the introduction of UI-Only formula fields that can use model lookups, being able to access these column summary values would be invaluable to us!

I hear your pain.  At this point you have to do all this in javascript… 

var sum = function(model, field) {<br> var sum = 0;<br> skuid.$.each(model.data, function() {<br> sum += this[field];<br> });<br> return sum;<br>}

If anyone else was looking for a quick and dirty JavaScript solution

Sweet! Thanks for sharing this little snippet Velvel.

Hi Velvel… just a quick follow up question. What would be added to write that sum to a UI field on the model - all rows I guess? Can it be done?