My intention is to have an app were users chooses and artist in a database and after that all songs that belongs to that artist arises in a list below.
I’ve set up the data like this:
User chooses an artist in the dropdown field and then click “Show songs”. Note that “artist” is a data field under the data type “music” as you can se above)
Then I want the “Show songs” button to trigger the music data to be shown in the RG.
- All the tracks that are supposed to be displayed are stored as a “list of texts” under the data field “songs”. To get the right data field displayed I typed in this. To get each song displayed on one row each I found out that “extract with Regex” with the shown string should do the trick.
IT DOESN’T! RG is empty (except a check box that shall be on each row too). IF I put #first:Item or similar it works, but in my case I must have each song listed on each row… Please help!
Link to app:
The checkbox fills the purpose of later on being able to mark each song the user wants to save to their own playlist they create (If any good help me out in advance with this that would also be tremendously appreciated)!
Any help is HIGHLY appreciated!
Have a data type called song and your desired fields i.e file. Have a data type called artist with a text field i.e name and a LIST OF SONGS. Do a search for artists and constrain the RG to the dropdown’s value. In your RG, have a second RG which is current cells songs.
You want your repeating group to be Type of content “text”. The text element in the repeating group is just “current cell’s text”.
The Data Source for the Display list in RepeatingGroup Action should then look like this: Search for Musics(constraint “artist = dropdowns value”):first item’s Songs.
@jaos.pcl Why would you do a nested repeating group if artists are unique? I agree tho that your data structure would be better in most cases than what he does.
If you structure your DB as a wrote you need to have a second RG because every artist has a “list of songs”.
No you only need one RG, because you already select the artist in the dropdown.
Well… you need an RG if you want to display a list of things.
Yes, and he wants to display a list of songs, not a list of artists with lists of songs in it.
I know that, the first RG will probably display only one artist so the visual result will be a list of songs. Behind everything he searches for artists. This is the easiest way if he wants to constrain it to a dropdown.
Performance wise, it’s a bad idea and should really not be recommended. I’m also not sure why it should be easier honestly.
Performance wise? He could go for a DB structure with only songs and an artist on every song and search for songs instead constrained to the artist’s name. Overthinking sometimes .
I have no problem with your proposed DB structure, as I wrote I even agree it would often be better than what he does.
The problem is the following: As you suggested to put the artist in a RG, Bubble will always search through ALL artists even if there can only be found one which is selected in the dropdown.
The other way, Bubble will stop the search as soon as the first artist was found. If you have thousands of records, this will have a big influence on your performance.
This is why you would never want to do it like this in that case.
I’ve never had an app with so many records so I have to stay low on this. Just a thought, aren’t there more songs than artists?
I think this will most likely be the case, but I think you may got me wrong here.
I did not refer to this:
But to this (your initial answer):
So I basically agree towards your first idea with the DB structure, it’s just that you shouldn’t put the single artist in a repeating group.
Thank you so much for that help. I thing Bubble is quite tricky when it comes to referring data. What both of you pointed out was so helpful!
And very amicably discussed well done!!
This topic was automatically closed after 70 days. New replies are no longer allowed.