calculation with value from previous record

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Using Tap Forms calculation with value from previous record

Viewing 3 reply threads
  • Author
    Posts
  • November 2, 2024 at 10:49 PM #51249

    Chris Templeton
    Participant

    Can I use a value from the previous record in a calculation for the record i’m adding. I’m tracking my car mileage.

    Mileage = 240,000
    total gallons = 10
    mpg = 30 calculated from ((240,000 – 239,700) / 10)

    previous record

    Mileage = 239,700

    November 3, 2024 at 4:52 PM #51252

    Brendan
    Keymaster

    Hi Chris,

    There’s no function for accessing the previous record directly. In a Script you could do it, but then you have to fetch the records, then get the record that’s at an index one behind the current record.

    but I have a form and script which you will run on the selected record that can create a new record, copy the data from the original selected record, then switch to the new record.

    Download the attached .tfarc file and import that into your document.

    So what you do is when you have your most recent record selected, run the script called New Mileage Entry (it’ll be on the Scripts tab on the right when you have the Form inspector panel visible). Then type in the new odometer value. Tap Forms will calculate the difference between the previous and new odometer values.

    Hope that helps!

    Brendan

    Attachments:
    You must be logged in to view attached files.
    November 11, 2024 at 9:59 AM #51286

    Chris Templeton
    Participant

    I’ve been trying to get the form to import but so far haven’t. I’ll keep trying on my iphone.

    Thanks for the script,

    Chris

    November 12, 2024 at 1:11 AM #51290

    Brendan
    Keymaster

    Do you mean the .tfarc file will not import for you? Did you try on your Mac or just your iPhone?

     

Viewing 3 reply threads

You must be logged in to reply to this topic.