Hi everyone!
I’m very new to Adalo (only 1 week in), so please forgive any inconsistencies in my question. I’m really excited to join this community and appreciate your support as I learn.
I have a collection that represents the levels required for an activity, and I’ve set up a many-to-many relationship between the “Levels” collection and the “Activity” collection.
I can display the activity name just fine using Magic Text, but when I try to display the level in a list, I only see “count” available instead of the level’s name.
Could someone please help me figure out how to display the level’s name using Magic Text, as it doesn’t appear in the list of options? Thanks so much in advance for your help and guidance!
Hi @Mims1 - someone please correct me if I’m wrong, but I believe that this is a limitation when using many to many relationships and often a reason why nested lists are often the solution. You would need to have a list, restricted to one row, within the main list row, to show the detail that you need.
Please let me extend the answer by @Tone. I’d call this not a limitation, but an expected behaviour.
Let’s take your example. You have Activities and Levels, and M2M relationship between them: an Activity can have many Levels, but also a Level can have many Activities.
Then let’s assume you’re trying to get the name of the level via an activity relationship (using magic text). You have a “Current Activity” on the page (meaning that you have access to all data values of some current activity record). But when you are trying to access the level, what exact level record should the app take and show to you? Remember, one Activity can have many Levels. Threrefore it is not possible to display the name of one level. That is why you’re seeing Count - this is the only possible operation in this case (you can get info how many levels an activity has).
And in case of Intensity - each Activity can have only one Intensity, so you can get Intensity Name, etc.
So in your case:
either you need to change database design so that one Activity has only one Level
or on a screen with Current Activity you create a List of Levels, filter them by Current Activity, and then select the level you need.
Thank you very much for taking the time to read my question and for your detailed responses. Thanks to you, I’ve noticed that this issue only occurs with M2M relationships. In my case, an activity can have multiple levels (e.g., advanced 1 & advanced 2), and I really would like to display all the records.
If I understood correctly, this is possible and for that I would need to follow the method @Victor described in point two—by creating a list of levels filtered by the current activity. Could you please provide more details on how to implement that? I’m particularly curious because I’d like to do the same for an activity’s “target audience” (for example, an activity could have both teenagers and adults), so that both records are displayed next to the activity name.
Eureka! I just found a solution! I hope you’ll be proud of me :D. When I gather the activity data, I create a field each time to enter the first level of the activity. The person chooses, for example, “Advanced 1” and then, in the second optional field, they enter the second level (for example, “Advanced 2”), and in the third field “Advanced 3.” Then, in my activities collection, I create not one many-to-many relationship, but three one-to-many relationships :D. And voilà, in the list I display level 1 + level 2 + level 3—that is, Advanced 1 + Advanced 2 + Advanced 3.
Just to clarify: this issue does not occur with only M2M relationships. You will see the same in 1:Many relationship between 2 collections, when you’re being on the side of “one”.
E.g. imagine have a relationship between Categories and Items, in a way that one Category may have many Items and one Item belongs uniquely to one Category.
So if you are on the screen with Current Category, you will not be able to select an item name / price / etc. via the magic text. The reason is the same - there are many Items which belong to a category, and builder can not guess which item should be selected.