Is it possible to sort added items within a database cell?

I have a database list of exercises and workouts. They have a many-to-many relationship.

When I create a workout and add multiple exercises to that workout, I would like to display the list of exercises for that workout in the order in which I added the exercises. Currently it automatically sorts it alphabetically (or reverse alphabetically).

Is there a way this can be changed to sort based on when which exercise was added first? Thanks in advance!

Hi,
select the list (the left parameters panel opens) scroll down to “sorting” and select “created date oldest to newest”

There are several other ways to sort, including by creation or updated date. But I like to add a number parameter to my collections, then sort by number. I call the field “sequence”.

This also make it easier to rearrange the order when necessary, something you can’t do when sorting by any other criteria.

1 Like

Thanks for your suggestions @MikesClub & @Benalihoussam !

However, I am asking something slightly different. My question is how to sort a list within a list (Inception style! :exploding_head:) based on the order of input.

So I’ve created an exercise list:
Exercise List

And I’ve added the exercises into this workout:

And when I test the app and open that workout, the default list’s order is based on the creation date of the exercise list (rather than the order in which I added the exercises into the workout):

I know I can sort that exercise list within the workout alphabetically, by creation date (of the exercise list), and upload date (of the exercise list)…but I don’t know how to sort by any other manual way, for example if I wanted the workout list order to be:

1- Deadlift
2- Bench Press
3- Tricep Dip

Does anyone know if this is achievable or if there is a workaround? Thanks! :slight_smile:

Is anyone experiencing this or know of a workaround?

you can add a number property on the collection, give the exercice you wanna see first the number one and so on, then filter the list using that property,

1 Like

Thanks for the suggestion @Benalihoussam ! :slight_smile:

But would you mind elaborating? I’m not sure I understand. Do I add a number property to the workout collection? How do I link that number property to the exercises that I select in that workout?

Hi @TrZd,

I think there is no way to sort it based on the user added way with relationships. But you could achieve this with creating another collection to store the exercises of that workout and sorting that list as Created Date- Oldest to Newest.

Made a quick clonable app :

And made a video too :

Jason ( @jasondupree ) made a wonderful Workout app and that app has this sorting and I think he also did the same way or maybe a different way!

To see Jason’s app :

Thank you

1 Like

@TrZd I did this with a “join table” collection. For a basic version of this, there’s 3 collections:

  • Workouts
  • Exercises
  • Workout Exercises

You don’t want to link exercises directly to workouts. Instead, link exercises to workout exercises, and workout exercises are linked to the workout. The workout exercise holds the data, like the order, sets, reps, rest, etc.

2 Likes

Thanks Jason for adding that. Appreciated! And I did this same way and the confirmation is correct!

2 Likes

Yessssss!!! That’s what I was looking for :smiley: You guys rock!!

Thanks so much for your time and efforts in responding and sharing the solution…much love!

1 Like

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