Use COUNT with calculated field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tim
    Junior Member
    • Aug 2024
    • 18

    Use COUNT with calculated field

    I want to add a field to list and detail view of an Account displaying the number of the Contacts. I wonder if I can use calculated field for that purpose? I don't see any sort of COUNT function though.
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    #2
    Increment field (number) by default you can only one in database, but Eblasoft has an extension (Number Pro), that you can use for several incremented numbers. Perhaps this would be a solution.
    Espocrm, New field type named "Number Pro" Similar to Espocrm Number field (auto increment) but you can make it incremental in groups You can pull the prefix from a linked entity varchar field You can specify an int field on the linked entity to hold the counter indicator There is separator param, optional with pad length like in Number fieldUse CaseOn of the most use cases is the order and order items, so if the order has number field you can add number pro to the order item that prefixed by the number of the orderSo if Order number is: O-00046The Order item number will be: O-00046-0001 Read information about the extension . Release notes are available here.

    Comment

    • tim
      Junior Member
      • Aug 2024
      • 18

      #3
      I don't want an increment. I want count, which can only go down. If calculated field is not an option my second guess would be a number field which will be updated by script on Contact save. ?

      Comment

      • item
        Active Community Member
        • Mar 2017
        • 1476

        #4


        is begining for your request

        If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

        Comment

        • yuri
          Member
          • Mar 2014
          • 8440

          #5
          No, on the database level it's not appropriate to use an aggregate function in a row.
          If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

          Comment

          • yuri
            Member
            • Mar 2014
            • 8440

            #6
            It's possible to utilize a left join with a sub-query. We did it in sales pack to calculate stock quantity in for a product. I believe it was already covered on the forum before.

            Left-join and a select expression can be added in recordDefs > selectApplierClassNameList​
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            Working...