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'.

Any help or suggested alternatives would be greatly appreciated.

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.

- 2,802 Points

Posted 5 years ago

Moshe Karmel, Champion

- 8,656 Points

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).

- 2,802 Points

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.

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

Rob Hatch, Official Rep

- 44,568 Points

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

- 2,802 Points

No worries. The rollup summary fields work just fine as an alternative.

Thanks for all your help Rob! Greatly appreciated.

Thanks for all your help Rob! Greatly appreciated.

Matt Sones, Champion

- 31,944 Points

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

- 922 Points

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!

Rob Hatch, Official Rep

- 44,568 Points

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

- 452 Points

var sum = function(model, field) {If anyone else was looking for a quick and dirty JavaScript solution

var sum = 0;

skuid.$.each(model.data, function() {

sum += this[field];

});

return sum;

}

- 2,802 Points

Sweet! Thanks for sharing this little snippet Velvel.

- 2,380 Points

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?