Announcement

Collapse
No announcement yet.

Infield calculation

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

  • Infield calculation

    We have a few software solutions that support this feature, so I was wondering if it is possible to incorporate infield calculation into EspoCRM as well .
    So for example, if there is an integer field "Sum", current Espo behavior is you type your number, click save - the number is displayed
    Feature I'm talking about: In the same "Sum" field, an ability to perform simple mathematical calculations
    So for example, if you type 110+20 into the integer field, the number that is saved is 130.

    Personally I find this feature very time saving, do you think that is something that can be added in the future as a "nice to have", or maybe into the Advanced Pack ?

  • #2
    Not sure if I'm reading this right, you the field to be able to do calculation in-itself? I doubtful this feature will be added anytime soon;

    You can already do this with Formula however. The issue with Formula is, you have to "Saved" it before it calculate.
    But formula is static... meaning if you create formula that say "FieldA+FieldB" then that all it can do. I'm not sure if you can be creative with formula; where the "+" can be anything depend on your needs.

    Thinking about it, I think it might be possible:
    FieldA Field1 FieldB

    Perhaps in the Field1 we can use some replacement formula? Where we add the formula as +, then the formula will +, if we put in "x" then the formula will multiple for example. This is all theory, I doubt it will work. But it still quite static.

    Then in in-field calculation would be good:
    110+20x(20)/5 then = value shown as answer... but unless you can convince developer what use does this field have then you could be waiting version 10 and still nothing.

    Comment


    • DashingUno
      DashingUno commented
      Editing a comment
      Yeah, I guess unless the devs themselves like the idea, the suggested function is a bit niche and not widely known

  • #3
    Hi @DashingUno,

    If I understood you correctly, you need a calculator in Entity.

    - Create three fields with type "Float" in Administration -> Entity Manager -> Your entity name -> Fields;
    - Create a formula in Administration -> Entity Manager -> Your entity name -> Formula
    Code:
    sumOfAddendums = addendum1 + addendum2;
    - For each calculator, create a separate block in the Layout Manager (screen 1) and name it, for example, "Additions". Display your three fields here;
    - You get a calculator (screen 2)
    Attached Files

    Comment


    • #4
      victor , esforim

      Espcrm was closer to what I meant Victor, I understand that static formulas can be used with multiple fields and that you can replicate a simple calculator with multiple fields, or even make them perform different mathematical equations with addition of lets say radio buttons and an If/Else clause in the formula for Addition/Subtraction etc. so that the field formulae changes to that specific math function, but what I meant is calculation within the same field.

      It may sound unnecessary, but once you try it, you don't want to go back lol.
      I guess closest - publicly available example of this functionality would be Google Sheet/Excel (Screenshot attached)

      It may not be the most popular or a widely known feature to be incorporated to non-excel tools, but if you use your espocrm to report compound sums that are calculated elsewhere, like we do, this is a nice feature to have

      Comment


      • #5
        A few questions arise.

        Should it be a simple math formula or a scripting language (like espo-formula we have in the backend). The former is easy to implement, the latter is an endeavor. The simple math formula has a limitation that it can't have conditions.

        Comment


        • #6
          The ones that we encountered in other software were all very strict, they had a set amount of allowed operators ( +, -, /, *) and brackets to be able to prioritize operators.
          So the suggested function isn't trying to become a scripted language, it's purpose is to save the time to reach for a calculator when there are a few numbers involved.

          Example: Stacy's job is to report taxis expense per person per day, she gets an itemized list from the employees, but we are not micromanaging it, we just want her to report the total per person.
          So instead of her inputting 7$+5$+10$+9$ into the calculator (because lets face it, almost nobody does this in their head anymore) and writing 31 into the "Yuri's total" she can just type 7+5+10+9 into the field.
          This is just an arbitrary example, but I guess there can be many uses to it

          Comment


          • #7
            I though first that it's about things like total amount calculation ($amount + $tax / 100.0). Inline calculation was considered to be implemented in the past but I set it aside for some reason (not remember why).

            Comment


            • #8
              Yes! Inline calculation, thank you, I was trying so hard to remember the proper name for it, glad to hear that there is a chance for it to be implemented

              The thing that you thought I meant also sounds interesting, although I guess it is even more niche than inline calculation, maybe that could be like an Advanced Pack upgrade, lol
              Like: EspoCRM - inline calculation, Advanced Pack - Inline Calculation Plus ( ability to use Field names and variables inline)

              Comment


              • esforim
                esforim commented
                Editing a comment
                I sure hope it not restricted to Extension only....

            • #9
              What about a "calculator" field, similar to how a calendar widget appears when entering dates ?

              Comment


              • #10
                Hi,



                why not have a globaly floating calculator or like excel, when type "=", a calculator pop-up ?

                Comment


                • #11
                  Planned for v7.4.

                  Comment


                • #12
                  Would you have an example how to use this. Where is the "=" entered for the calculation and what is the syntax to refer other fields ?

                  Comment


                  • shalmaxb
                    shalmaxb commented
                    Editing a comment
                    = a+b-c etc.

                • #13
                  > Where is the "=" entered for the calculation


                  Click image for larger version

Name:	image.png
Views:	176
Size:	74.2 KB
ID:	100335

                  > what is the syntax to refer other fields

                  No such, otherwise it would have been stated.

                  Comment


                  • item
                    item commented
                    Editing a comment
                    sorry .. but this make my day :

                    where is the "="..
                    and Yuri post the keyboard


                • #14
                  ok, funny, funny....but seriously...how and where can this be used...its not clear at all...many thanks.

                  Comment


                  • #15
                    Originally posted by rouhu View Post
                    ok, funny, funny....but seriously...how and where can this be used...its not clear at all...many thanks.
                    Your question was answered above...

                    Click image for larger version  Name:	image.png Views:	0 Size:	7.2 KB ID:	100355
                    And in this topic there is a detailed description of how it was supposed to work, before this functionality was introduced in EspoCRM.

                    Click image for larger version

Name:	image.png
Views:	312
Size:	54.9 KB
ID:	100353

                    ​To test it yourself, in the Int/Float/Currency type field, write:

                    Click image for larger version  Name:	image.png Views:	0 Size:	4.7 KB ID:	100354
                    You will get result 5.​

                    More details: https://github.com/espocrm/espocrm/issues/2552.

                    Comment

                    Working...
                    X