Assigning values from Column Summaries to Fields

  • 1
  • Question
  • Updated 1 year ago
  • Answered
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.
Photo of mB Roman Melnik

mB Roman Melnik

  • 2,802 Points 2k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
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). 
Photo of mB Roman Melnik

mB Roman Melnik

  • 2,802 Points 2k badge 2x thumb
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.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Though the summary values are built into the table component - we do not expose them through the javascript API.   Sorry. 
Photo of mB Roman Melnik

mB Roman Melnik

  • 2,802 Points 2k badge 2x thumb
No worries. The rollup summary fields work just fine as an alternative.
Thanks for all your help Rob! Greatly appreciated.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Any chance those values will be exposed anytime soon? It would be super handy! :)
Photo of Oliver Sinfield

Oliver Sinfield

  • 922 Points 500 badge 2x thumb
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!
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I hear your pain.  At this point you have to do all this in javascript.. 
Photo of Velvel Marasow

Velvel Marasow

  • 452 Points 250 badge 2x thumb
var sum = function(model, field) {
var sum = 0;
skuid.$.each(model.data, function() {
sum += this[field];
});
return sum;
}
If anyone else was looking for a quick and dirty JavaScript solution
Photo of mB Roman Melnik

mB Roman Melnik

  • 2,802 Points 2k badge 2x thumb
Sweet! Thanks for sharing this little snippet Velvel.
Photo of David Forder

David Forder

  • 2,084 Points 2k badge 2x thumb
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?