Announcement

Collapse
No announcement yet.

How to get sum of specific values of an entity in another entity?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get sum of specific values of an entity in another entity?

    I have two entities result and student. In result entity i have 2 fields "score"(Integer) and "resultStatus"(Enum). resultStatus has 2 values "Passed" and "Failed".
    I want to get the sum of "Passed" values in student entity.
    I have applied the formula below and it works fine but fetches the sum of all the passed/failed status. How can i get the sum of "passed" status. (that is sum of columns when resultStatus="Passed").
    this is the formula i have applied . totalScoreAchieved=entity\sumRelated('results', 'score','student'); Please help me to resolve the issue .

  • #2
    Hello,
    try this https://github.com/espocrm/documenta...titysumrelated.

    Comment


    • #3
      I have applied this..created a report and reportfilter and reportfilterid has applied ..but didn't work..

      Comment


      • #4
        Do you have a relationship between the result and student as One-to-Many? If so, and you are using a Report feature, I think that you don't need to use Formula.

        Comment


        • #5
          You are not applying the filter, you are adding all the related records.

          saldodos=entity\sumRelated('estadoDeCuentaYPagos', 'pagoTotalARealizarConverted',
          'Pago Atrasado');

          Help!

          Comment


          • #6
            Hi sandra6012
            Could you explicit it? Does it mean that you are trying to sum 'pagoTotalARealizarConverted' by using a filter like 'Pago Atrasado'? Right? If so, there is no such filter in the system. You need to add it to be able to use it. Please investigate this post https://forum.espocrm.com/forum/deve...6640#post56640.

            Comment


            • #7
              How to update result field (the number of hours of two datetime fields) based on 'startwork', 'stopwork'. Both fields are datetime

              Comment

            Working...
            X