Creating a Gym Workout Log

Viewing 4 reply threads
  • Author
    Posts
  • March 5, 2020 at 11:25 AM #39748

    Simon Smailus
    Participant

    I’m returning to TF after a few years absence and trying to familiarise myself, especially with relationships. I’m trying to create a Gym Workout Database that requires the following data:

    The exercises are split between 3 workouts each focusing on a different part of the body. Workout 1, 2 and 3. Workout 1 is done Mondays, Workout 2 on Wednesdays and Workout 3 on Fridays.

    I want to be able to open the app choose which workout I am doing and have all the exercises for that workout for that session.

    In terms of relationships one workout session will be either workout 1,2 or 3. Workout 1,2 and 3 have different exercises. Each exercise will complete 3 sets recording the weight and reps done per set.

    I’ve tried several different forms, but keep failing.

    Could use some pointers here.

    March 5, 2020 at 3:07 PM #39754

    Sam Moffatt
    Participant

    Let’s do the simple piece first: workouts and exercises. Workout is the main form and there is a Link to Form Many to Many (M:M) to Exercises (assuming that some exercises may happen in multiple workouts). That’s the easy part.

    A challenge here is that you need a field to define ordering and maybe different workouts have different orders of exercise which would mean you need to have another form to track the order of the exercise in the workout. Maybe ordering of the exercises in a workout isn’t important though I suspect it might be. If that is important, you’d need a third form to store that ordering information that would be linked to workout and exercise. Alternatively you duplicate the exercises and use a One to Many and embed the ordering that way (pro: only two forms; con: duplicated data).

    The next step is that you want to track, per day, each of the workouts with the sets. I’d create a form for tracking each day you work out. The basis of this form feels like it should have a field for the day you worked out and a Link to Form M:M to your workouts because your workout defines what exercises you should do. That leads to the next piece: recording the sets and the weights/reps done per set.

    A way of approaching this would be to have the day form that tracks each day you work out. This is useful for creating Link to Form JOIN fields that automatically aggregate all sets on a given day for example. This may or may not be useful to you, you’d have to play with to see. The next piece would then be to have a separate form for each set. Each set you do would have a date field in it and I’d use a Link to Form field with the JOIN type on the date fields to JOIN them together. In both the days and sets forms have the date fields enabled with “Set Current Date”. This will make it easy to just create records and Tap Forms sets up the value correctly. This gives you a quick way of filtering what sets you did on a given day and the JOIN automatically links them together.

    From here I’d create a new Link to Form 1:M field between exercises and sets. This assumes a workflow where you start with a workout, go into the linked exercises for it and then you create a new set for that exercise. When you create the set, it’ll automatically set the date to the current date and link it to the exercise. You can then enter in the weights and reps for each set, one record at a time. Then when it comes time to do another exercise, you hit back a couple of times to get back to your exercise list and select a new exercise. Make sure when you link exercises to sets you tick “show inverse relationship” to create a field on the other side. This gives you the ability to go from set to exercise and if you’re using Tap Forms on the Mac, it’ll give you a small snapshot of the exercise inline (it does something similar on iOS but I think it looks cooler on the Mac).

    You could use scripting to make some of this a little quicker to enter, especially on iOS, with the support of a prompter but I think this should come to you.

    Pseudo-modelling it:

    Workouts Form:
    - Workout Name - Text
    - Exercises - Link to Form (M:M): Exercises

    Exercises Form:
    - Exercise Name - Text
    - Exercise Instructions - Notes
    - Sets - Link to Form (1:M): Sets
    - Workouts - Link From Form (automatically created by ticking "show inverse relationship" on the Exercises Link to Form field in the Workouts form)

    Workout Days Form:
    - Workout Date - Date (Default Value: Set Current Date)
    - Sets - Link to Form (JOIN): Sets on Workout Date == Set Date

    Sets Form:
    - Set Date - Date (Default Value: Set Current Date)
    - Exercise - Link From Form: Exercises (automatically created by ticking "show inverse relationship" on the Sets Link to Form field in the Exercises form)
    - Weight - Number
    - Reps - Number
    - Date Created - Date Created (special field type; use it for sorting the Sets form)

    That’s a little more complicated than I think you were expecting but that should work to model your data based on what you’ve said. You might need another form that handles the ordering for you but I think if you modelled that for use on your phone, you’d not want to use it very quickly (too many extra taps). You could reduce down the number of taps you’d need with some scripting but this should work without any scripting.

    March 6, 2020 at 1:03 AM #39763

    Brendan
    Keymaster

    That’s a great description Sam!

    I wonder if maybe instead of a Sets form, a Sets Table field would work on the Workouts form?

    The Sets form could get its exercise information from the Exercise form, but have the extra fields to record the weights, rep, and date.

    It would remove one less level from the relationship hierarchy.

    Then when a Workout is to be created, you can just select the appropriate exercises from the Exercise form to populate the Sets Table field.

    Just an idea.

    Thanks,

    Brendan

    March 6, 2020 at 6:41 AM #39764

    Simon Smailus
    Participant

    Thanks guys, this is really helpful!

    March 6, 2020 at 5:34 PM #39771

    Sam Moffatt
    Participant

    I did consider having a table field but decided against using that because it’d require a script field to make it work properly. I feel that could be a pretty powerful way of modelling the data as well because it encapsulates it in a single form instead of having two forms. If you were willing to put the time into building a script to basically create a new day then a table would work well, especially if ordering is important. I ultimately ditched that because it’d need a script to make it work really smoothly and went for a design that wouldn’t require scripting but should work reasonably efficiently.

    If you do go down the scripting pathway, having a form script the days form (either in the table or link to form setup for recording the actual measurements) that is hooked into the prompter can make it a little quicker to do data entry on iOS. Tapping into each field and saving is a little time consuming and using the prompter can make that a little quicker. I’m using this with a barcode scanning use case where I scan an item barcode and a box barcode via prompter (to capture the enter key) to quickly update fields.

Viewing 4 reply threads

You must be logged in to reply to this topic.