Related Fields Totalling - Forum - Rollbase - Progress Community

Related Fields Totalling

 Forum

Related Fields Totalling

This question has suggested answer(s)

Can a related field (currency for example) be totalled inside a report or list view? 

All Replies
  • Hi Eric,

    The related field cannot be used for totaling. You could use an Expression field to achieve this.

    Could you let us know the scenario that you are trying to achieve?

    Thanks,

    Shivani.

  • Hi Eric,

    You could use following code in HTML template report to get the sum of all related field(Currency type) for each record.

    Example:

    I have created two objects ObjectOne and ObjectTwo with 1-1 cardinality . Created "Currency Field" in ObjectTwo ,used related field in ObjectOne as "Currency Field". In HTML template report used following code. Please note there could be another way to do this.I have used simple method by looping all the records in "ObjectOne" and summed up related fields(currency fields).

    <html>

    <head>

    <script>

    function sum() {

    var sum=0;

    {!#LOOP_BEGIN.all#XqYfrWJQQZuyp-T-PaxH1Q}

    var number = Number("{!relatedfield}".replace(/[^0-9\.]+/g,""));

    console.log(number);

    sum=sum+parseFloat(number);

    {!#LOOP_END.all}

    document.getElementById('id').innerHTML = sum;

    }

    </script>

    </head>

    <body onload="sum()">

    <span id="id"></span>

    </body>

    </html>

     

    Please find attached app.xml for your reference.

    Regards,

    Shiva

    SampleCurrencyApp_v2.xml