Getting Sums from related List view

Hiya wonderful people!

I have a couple of issues:

I have a view that has a sum on it:

But in the related view there is no sum :frowning:

Is there a way to get the sum showing in the related view?

Additionationally, is there any way to get that sum and place it in a field?

Thanking you much! :slight_smile:

Hello @Jamal_Smith-Graham !

To calculate the sum and show it in the form is the only option to display the total by the column.

To do so, please use the code below. Also, you can disable the Total field so a user will not set it manually.

Please do the following changes in the code:

  • Replace {SPDataTable0} with the List or Library Control internal Name.

  • Change Value in the code (in places like value[i].Value and value[i].Value.replace(/$/g,'')) with the InternalName of the Total Sale Price column. You can check the InternalName in the designer, if you open the child form:

     function calcTotal() {
    var value = fd.control('{SPDataTable0}').widget.dataItems();
    var total = 0;
        for (var i = 0; i < value.length; i++){
              total += parseInt(value[i].Value.replace(/[^0-9.]/g, ""));
    fd.field('Total').value = total;
    var myVar = 0;
    fd.spRendered(function() {
    // disable the field
    fd.field('Total').disabled = true;
    //refreshing the  total
    var myVar = setInterval(calcTotal, 2000);
    fd.spBeforeSave(function(spForm) {
        var myVar = setInterval(calcTotal, 2000);

Thanks for this @mnikitina it worked! Pefectly!

You are a :star: :slight_smile:

1 Like