# Storing multiple workout types, durations and dates to the same user

**URL:** <https://community.glideapps.com/t/storing-multiple-workout-types-durations-and-dates-to-the-same-user/67567>\
**Category:** Ask for Help\
**Created:** [November 6, 2023, 2:47pm UTC](https://community.glideapps.com/t/storing-multiple-workout-types-durations-and-dates-to-the-same-user/67567 "2023-11-06T14:47:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![onemohrtime](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/onemohrtime/32/66128_2.png) [@onemohrtime](https://community.glideapps.com/u/onemohrtime)\
**Post date:** [November 6, 2023, 2:47pm UTC](https://community.glideapps.com/t/storing-multiple-workout-types-durations-and-dates-to-the-same-user/67567/1 "2023-11-06T14:47:04Z")

</div>

I’m creating a workout/wellness app.

A user can add workouts or wellness activities, add a duration for each, and a date for each (assumed “today” by default). There can also be multiple workout or wellness activities per day. Currently the user rows are a glide table with a column for _Exercise_, _Exercise Date_, _Exercise Minutes_, and the same for wellness. Each is storing _Text_, _Date_, and _Number_ values respectively.

The problem become pretty obvious right away. Each column is only storing one value for each cell, which means the calendar view is only ever showing 1 date as “complete”. How can I store these multiple workout values (that are still related to each other in name, date, minutes) per user without creating a huge amount of columns?

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [November 6, 2023, 3:20pm UTC](https://community.glideapps.com/t/storing-multiple-workout-types-durations-and-dates-to-the-same-user/67567/2 "2023-11-06T15:20:31Z")

</div>

> [@onemohrtime](#):
>
> the calendar view is only ever showing 1 date as “complete”

What do you mean? What experience do you want to create in the Layout Editor?

Overall you seem to be doing well:

1. One Workout-Wellness table with the following columns: RowID, Exercise, ExerciseDate, ExerciseMinutes, ExerciseType (either ‘Workout’ or ‘Wellness’). Every time a user logs a new exercises, a new row will be added.
2. One ExerciseType table with a RowID and a Type column with two rows (Workout and Wellness) that will be the data source for a choice component.

---

<div class="post-metadata">

**Author:** ![onemohrtime](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/onemohrtime/32/66128_2.png) [@onemohrtime](https://community.glideapps.com/u/onemohrtime)\
**Post date:** [November 6, 2023, 6:50pm UTC](https://community.glideapps.com/t/storing-multiple-workout-types-durations-and-dates-to-the-same-user/67567/3 "2023-11-06T18:50:25Z")

</div>

@nathanaelb This would be over 2 different screens in the Layout Editor.

- Screen 1 will have two dropdown fields, one for exercise and one for wellness. If one is selected, conditional fields appear underneath, asking for date and minutes. Ideally, this would also trigger a second button saying to “add another exercise/wellness” depending on which dropdown was triggered. Then there’s a save button that is expected to save this data to the table.
- Screen 2 will have a calendar view, and you will be able to see which day(s) have had an activity done on them. These will be accumulated into team counts for wellness challenges as well, but that is a future issue for now.

Does that clear it up a little more? If I were to have an entire table for exercises, would these essentially turn into Relations?

EDIT: Screenshot added for clarity

 ![Screenshot 2023-11-06 at 14.07.40](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/c/2c6dfc0178f3b8c89af3a3c4b5853256ba96b40e.png)

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [November 6, 2023, 10:02pm UTC](https://community.glideapps.com/t/storing-multiple-workout-types-durations-and-dates-to-the-same-user/67567/4 "2023-11-06T22:02:34Z")

</div>

You do have a table that will house one workout and one wellness session per row, right?

---

<div class="post-metadata">

**Author:** ![onemohrtime](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/onemohrtime/32/66128_2.png) [@onemohrtime](https://community.glideapps.com/u/onemohrtime)\
**Post date:** [November 7, 2023, 2:58pm UTC](https://community.glideapps.com/t/storing-multiple-workout-types-durations-and-dates-to-the-same-user/67567/5 "2023-11-07T14:58:45Z")

</div>

@nathanaelb I didn’t before, but I do now. This is my first Glideapps project, so I’m not sure how to relate two tables of data to each other in this way, yet. I’m aware of something called “Relations”, but assumed it would be better to have some sort of large `array` or `object` in one cell, for each user?

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [November 7, 2023, 3:07pm UTC](https://community.glideapps.com/t/storing-multiple-workout-types-durations-and-dates-to-the-same-user/67567/6 "2023-11-07T15:07:06Z")

</div>

There are many way of doing things.

You could:

- Have an Activities table where you will house your activities (workouts and wellness sessions), with one session per row.
- In the Activities table, you could have a basic text column called ‘Activity Type’ which would indicate if each row is either a ‘Workout’ or ‘Wellness’.
- You could have a ‘Choices’ table where in one column one row will be Workout and another Wellness. This table and column would be used in a choice component when you need to write a new row in the Activities table.
- Use the Users table for user-related information only (for now).

For now, you could use the Show Add Screen and Form Container as forms to submit data to the Activities table.

This could be done differently of course.

---

<div class="post-metadata">

**Author:** ![onemohrtime](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/onemohrtime/32/66128_2.png) [@onemohrtime](https://community.glideapps.com/u/onemohrtime)\
**Post date:** [November 7, 2023, 3:55pm UTC](https://community.glideapps.com/t/storing-multiple-workout-types-durations-and-dates-to-the-same-user/67567/7 "2023-11-07T15:55:05Z")

</div>

Interesting, I have been making all columns user-specific, assuming that that’s how you would want to store the data. Otherwise, wouldn’t the calendar view show **all** workouts entered by **all** users, rather than just the logged in user?

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [November 7, 2023, 4:00pm UTC](https://community.glideapps.com/t/storing-multiple-workout-types-durations-and-dates-to-the-same-user/67567/8 "2023-11-07T16:00:40Z")

</div>

> [@onemohrtime](#):
>
> wouldn’t the calendar view show **all** workouts entered by **all** users, rather than just the logged in user?

Every time you would write a new activity to the Activities table, you would also write the email address of the owner of that activity. You would then either filter the collection in the Layout Editor to only display activities that have the same email address as the email address of the signed-in user, or better you could apply row ownership to the Owner column in the Activities table and only one own’s activities would be downloaded to a user’s device.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [November 14, 2023, 4:01pm UTC](https://community.glideapps.com/t/storing-multiple-workout-types-durations-and-dates-to-the-same-user/67567/9 "2023-11-14T16:01:08Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
