Mileage Tracker (Tap Forms 5.3)

This topic contains 5 replies, has 3 voices, and was last updated by  Brendan 3 months, 2 weeks ago.

  • Author
  • October 11, 2018 at 10:20 AM #30998


    I created a mileage tracker form but posted it in the regular forum. Figured I should post it here for everyone to download. It requires Tap Forms 5.3 at a minimum because it uses JavaScript to copy the previous mileage value to a new record. You need to select a record and then run the script. Tap Forms will create a new record and copy over the values from the selected record to the new record.

    Use the Import Tap Forms Archive function to import this file.



    You must be logged in to view attached files.
    November 25, 2018 at 9:48 PM #32071

    Ryan M

    Thought I’d play around and see if I could come up with a different approach to the same mileage tracker. This would probably be closer to a fuel log rather than a simple mileage tracker.

    The inputs would be:

    – odometer value
    – Price per gallon
    – Gallons filled

    A script would calculate your mileage since last fill up as well as your miles per gallon.

    The script uses the default created date field to sort all records by their created date. This assumes that you’re entering in your mileage log around the time you filled up.

    Here’s the script for those interested

    var odometer_id = 'fld-9674e316bfed408ca6710ce81b72bf05';
    var vehicle_id = 'fld-64b0b17a635f49b8b40867e45f8d24db';
    var date_created_id = 'fld-2097149a2eeb4d4e892f13b62de6b5ea';
    // sort records in ascending order by date value
    var dateSorter = (a, b) => 
      a.getFieldValue(date_created_id) - b.getFieldValue(date_created_id)
    var run = () => {
      var vehicle = record.getFieldValue(vehicle_id);
      var odometer = record.getFieldValue(odometer_id);
      var records = form.getRecords()
        .filter(r =>  r.getFieldValue(vehicle_id) === vehicle)
      var odometerValues = => r.getFieldValue(odometer_id));
      var currentRecordIndex = odometerValues.indexOf(odometer);
      var previousRecordIndex = currentRecordIndex === 0 ? 0 : currentRecordIndex - 1
      var mileageValue = odometerValues[currentRecordIndex] - odometerValues[previousRecordIndex]
      return mileageValue;
    You must be logged in to view attached files.
    November 25, 2018 at 10:42 PM #32074


    Hi Ryan,

    For some reason Askimet flagged your response as spam. But I noticed it and marked it as not spam so it shows up now.

    Thanks for posting your alternative for the mileage tracker!


    November 25, 2018 at 10:43 PM #32075

    Ryan M

    I was wondering what happened. Thanks, Brenden!

    December 5, 2018 at 11:36 AM #32411

    Chris Stovall

    I have TapForms 5.3.4 but I can’t open the attached file. I tried in the finder and also doing a file/open. Not luck either way. What am I missing?

    December 5, 2018 at 2:08 PM #32415


    Hi Chris,

    This is a Tap Forms Archive file. Use the Import Tap Forms Archive command in the File menu to import it.



You must be logged in to reply to this topic.