Formula Help - Multiple Entity Field SUM

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nishan Perera
    Active Community Member
    • Jan 2019
    • 348

    Formula Help - Multiple Entity Field SUM

    Hello,

    I've a requirement to SUM multiple entities one field value into one entity one field.

    Example - Entity A, B, C having field type float as duration. In this I want to calculate A, B, C entities duration field data into User wise entity Total duration field.


    * If possible I need monthly or quarterly wise based on the start date and end date

    Appreciate the prompt support for this request.
    Cheers!
    Nishan.
  • Nishan Perera
    Active Community Member
    • Jan 2019
    • 348

    #2
    Originally posted by Nishan Perera
    Hello,

    I've a requirement to SUM multiple entities one field value into one entity one field.

    Example - Entity A, B, C having field type float as duration. In this I want to calculate A, B, C entities duration field data into User wise entity Total duration field.


    * If possible I need monthly or quarterly wise based on the start date and end date

    Appreciate the prompt support for this request.
    Any Support on this ?
    Cheers!
    Nishan.

    Comment

    • shalmaxb
      Senior Member
      • Mar 2015
      • 1605

      #3
      I guess (and I only can guess, because I do not know, how you made your entities), that you should be able to achieve that by this: https://docs.espocrm.com/administrat...titysumrelated

      Another way could be (also guessing), that you build a relationship (not n:n) between entities a, b and c to user and fetch the duration values from the entities a,b, and c into fileds of the user entity. Then you sum these fields.

      Comment

      • lazovic
        Super Moderator
        • Jan 2022
        • 810

        #4
        Hi Nishan Perera,

        Please note that your Entity with field duration and Entity User must have a relationship with each other.
        You can set it in Administration > Entity Manager > User > Relationships.

        Then, try to insert into your User Formula this string:

        totalDuration = entity\sumRelated('yourEntities', 'duration');

        Comment

        Working...