In short, I need to establish a data structure where I can create a thing for a Parent and its Children, but then be able to edit each Children’s thing independently of the Parent and other Children’s things.
It is for a workout programming app built for Personal trainers/Strength Coaches. The current data types include Group (contains a list of Clients), Client, Workouts (contains a list of exercise instances), and Exercise instances.
I need the user to be able to create a Workout for a Group of Clients so that each Client has their own Workout based on this Group Workout. I also need the user to be able to edit this Workout for each Client (Eg. adding/removing/editing the list of exercise instances) without the changes being applied to the Group’s Workout. I still need any changes to the Group Workout to be applied to the Clients Workout, even if there have been changes to the Client Workout (unless the Client Workout has been deleted).
Thanks in advance for your help!
@romanmg Could you provide some help here, please?
You can create a Date Type “Workout” with all the fields you need. Then you can create a Data Type “Clients” and add all the fields you need + a field called Workout and when you select the field type, you can set it to “Workout”
This way you can select that Client and edit its workouts.
The lesson here would be that when you are adding fields for a Data Type you are asked the type of field it is and during that time you can select other Data Types as the field type.
Hey @shawnmi6, I appreciate the response. However, this doesn’t solve the main problem I have. Your solution incorporates part of what I need to be able to do, but it doesn’t allow me to create a Workout for a Group of Clients so that each Client has their own version of this Workout that can be edited independently of the Groups workout.
I hope this clears things up and I look forward to any further suggestions you have
Can you not just make multiple Workouts and add them to your Clients record in your DB?
This way you can select a particular client and his linked workout and edit it without it affecting the other clients.
I have done that whilst trying to figure this out but I ran into a problem. After creating the same workout for each client in the group, how would I edit the workout for the entire group?
For example, I could make a workout with a Squat and a Push Up for each client in the group. It’s true that I’d be able to make changes to each clients workout individually, but what if I wanted to add a Pull Up to the entire group?
Further, how would I display only the common workouts and exercises amongst the group in a repeating group?
Thanks for your help so far and I appreciate your patience
To make a change - like adding Push ups to each work out. You will select Data > Make a change to a list of things and you will do a search for those clients and then you will select there workout fields. This will allow you to make a change to everyones workout program.
Looking up the workouts in a RG is something very similar. You make the Data Type = Workouts and for the Data Source you Do a search for those clients and select their Workout fields.
For this to make logical sense. You would need to have Workout as a Data Thing and Clients as a Data Thing and one of your fields in your Client data thing should have a field which has a field type = to Workout (The Data thing you created earlier)
The adding of an exercise solution certainly solves the issue and is something I’ve already implemented, but the displaying of the Group workout doesn’t solve the problem.
If I do a search for those clients workouts and display them in a RG, it will display all of the clients workouts and exercises. I need the RG to only display the workouts and exercises within those workouts (which are contained within another RG inside the workout RG) that are common amongst all clients. Adding :unique elements to the search doesn’t work as it removes the duplicates but shows the workouts/exercises even if theres only one instance of them.
:intersect with could work if I had a fixed number of clients per group by doing: Search for workouts:first item:intersect with Search for workouts:item #2:intersect with… etc. But since theres no fixed number this wouldn’t work (as far as I can tell) because if for example theres 9 Clients in the group and the expression goes up to 10, the expression would return nothing as the 10th item has zero entries and therefore items 1-10 have zero entries in common.
This is why I thought a data structure solution would be fit for this problem as I couldn’t figure the above issue out. It’s been doing my head in as its a critical part of my app.
Again, thanks for your patience
Disregard the above as it doesn’t fix my problem. I need the group workout to essentially be a ‘template’ workout for each client rather than it represent common exercises between clients workouts. Going back to the original post, I need to be able to delete an exercise at the Client level, but still have this exercise represented at the Group level. Therefore showing the common exercises and workouts of the group wouldn’t work. That’s why I think the solution needs to be at the database level.