Calculate between two given fields (distance for km registration)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scdzaak
    Member
    • Aug 2014
    • 51

    Calculate between two given fields (distance for km registration)

    Is their a way to calculate between two given fields with km (car tracking) information.

    I mean:

    Field one: The start of the Km clock in your car.
    Field two: The km given after custom visit when you arrived at the office again.

    Field1 = 23456 ( km)
    Field2 = 23512 ( km)
    Field3 = The result from 2 minus 1

    Regards,

    Eric
  • yuri
    Member
    • Mar 2014
    • 8442

    #2
    No such ability.
    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

    • scdzaak
      Member
      • Aug 2014
      • 51

      #3
      If I want to make an extra source code change for the question above.
      In which file I can do that the best .. ( Json code - php or combination )
      Of course the updates of espocrm will not 'see' this so you have pay attention for that !

      Comment

      • yuri
        Member
        • Mar 2014
        • 8442

        #4
        json, php, javascript
        Create your php in custom
        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

        • buratz
          Junior Member
          • Aug 2014
          • 13

          #5
          Scdzaak did you find a solution for this? I have a similar requirement and am looking for some guidance.

          Comment

          • yuri
            Member
            • Mar 2014
            • 8442

            #6
            Create custom/Espo/Custom/Repositories/{EntityName}.php

            PHP Code:
            <?php
            namespace Espo\Custom\Repositories;
            
            use Espo\ORM\Entity;
            
            class YourEntityName extends (extend from existing repository of your entity)
            {
                 protected function beforeSave(Entity $entity)
                 {
                      parent::beforeSave($entity);
                      $distance = .....;
                      $entity->set('yourNewFieldForDistance', $distance);
                 }
            
            }
            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

            • scdzaak
              Member
              • Aug 2014
              • 51

              #7
              Many thanks I have to find out how to place the code in the running application ..

              Comment

              • esforim
                Active Community Member
                • Jan 2020
                • 2204

                #8
                Wow this is an old thread. Not sure what 2015 was like, but this Field2-Field1 is easily accomplish with Formula now-a-day isn't it? Or you want this to be Live and always active.

                Comment

                Working...