How do i get the sum of values in a column of an entity in another entity?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sujithraalink
    Member
    • Oct 2018
    • 94

    How do i get the sum of values in a column of an entity in another entity?

    I have an entity called "Result". and there is a field called "score" in Result entity. each entry comes under "score" column. I need to get the sum of all entries in the "score" column and the sum has to come under another entity "Certificate" where i have a field called "grandTotal". the sum has to get in "grandTotal" field . Please help me to resolve this issue.
    This is the formula i have applied in Certificate entity. there is a many to many relationship between "certificate" and "Result" entity.
    grandTotal = entity\sumRelated('results', 'score');
Working...