Announcement

Collapse
No announcement yet.

Calculate between two given fields (distance for km registration)

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

  • 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

  • #2
    No such ability.

    Comment


    • #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


      • #4
        json, php, javascript
        Create your php in custom

        Comment


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

          Comment


          • #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);
                 }

            }

            Comment


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

              Comment


              • #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...
                X