Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Script Talk › Creating a simple calculation
- This topic has 2 replies, 2 voices, and was last updated 3 years ago by Anthony Caruana.
-
AuthorPosts
-
December 5, 2021 at 8:15 PM #45958
Anthony CaruanaParticipantHi there. I’m a bit of newbie at this. I’m creating a simple system for tracking the distance I cover in my running shoes. I have two simple forms. One is Run Details with the following fields:
Date and time
Shoe Name
DistanceI ahem second from called Shoe Details with the following fields.
Shoe Name
Brand
Model
Size
Purchase DateI’d like to add one more field to the Shoe Details for that gives me the total distance I’ve run in that shoe. It would, for each shoe, add the Distance field from the Run Details records.
I assume I need to use a script for this but I’m totally clueless in how to do this.
TIA
December 5, 2021 at 10:00 PM #45959
Sam MoffattParticipantA simple calculation field should do the trick but you’ll need a Link to Form field as well.
In the Shoe Details form, create a new Link to Form field and then at the bottom of the field panel select the Run Details form as the value of the “Link to Form” setting and then set the Link Type to Join. This will let you select the Shoe Name field for the two drop downs at the very bottom. By doing this you link all of the entries in the Run Details form with your Shoe Details form.
Once we’ve got the link in place, you need to create a Calculation field to calculate the total. When you create the calculation field, either double click on the field name or scroll down to Edit Formula… to enter in the formula. In the sheet that appears you’ll want to scroll down to the Distance field and double click on it. It should automatically insert the field and set it to Total. If it doesn’t, no worries, just click on the little arrow on the right of the field name and it should let you swap between the built in aggregation.
Hit save on the calculation field and you should see the total distance for that particular shoe based on the linked records. Don’t forget to update the decimal places and any other number settings you might want for the calculation field because by default I think it’ll give you zero decimal places.
I just had a realisation that you might also be doing this on iOS. The process is mostly the same though there are a few extra taps to get to various settings. The calculation editor on iOS is a little simpler so you’ll want to put in
[TOTAL::Run Details::Distance]
to get the total distance from the Run Details form. I don’t use the iOS version as heavily for form editing so I don’t remember off the top of my head all of the steps as on the Mac.Good luck!
- This reply was modified 3 years ago by Sam Moffatt.
December 6, 2021 at 5:03 AM #45964
Anthony CaruanaParticipantThis is perfect and does what I want. Thanks for the help.
-
AuthorPosts
You must be logged in to reply to this topic.