Apologies in advance, surely this question has been asked, but after 3 nights of troubleshooting and googling I still haven’t made progress.
The app I’m building allows a user to choose their favourite tracks that they have been listening to on Spotify over the last 4 weeks, and write a description on why they have been enjoying them. My API calls are working, and I have a repeating group displaying each track. I also have a custom state, called Selected Tracks, which is a list of Spotify items. When the checkbox for a specific track is selected, Selected Tracks gets that Spotify item added to it.
I have another repeating group that displays each of the items of the Selected Tracks list. There is also a multiline input next to each of these items, where the user can write out the reason they have been listening to this track (yes I have some formatting issues right now )
When the user clicks save, the Selected Tracks are saved to the database as one list.
I would also like the descriptions to be saved… but I am really struggling to work this out. I want them to be saved as a list of texts. There are probably multiple ways to do this, one extra consideration I have is that if a Spotify track gets de-selected, the descriptions should move up with their respective track i.e track 2 is deleted, so track 3 becomes track 2, and therefore description 3 should become description 2.
Again, apologies, someone will probably point me to somewhere on this forum where the question has already been asked…
This is a database issue…if you are not familiar with I highly recommend taking a look at relational database design. It is a huge help to have knowledge of web/app development essentials such as database, UI and UX design…resources off the bubble forum are where I learned, so that my development was quicker and less of a headache.
To your question…you need another datatype in the database that is related to a user.
So you have a data type of user, but you also need a data type of favorite tracks.
Your favorite tracks data type should have a data field for track and any other info about the track you want to save from Spotify. But, it should also have a data field of text, label it what you want ( maybe “description” )
In the “description” data field is where you save the text about why they like the track.
A key point is that each of these things is being saved INDIVIDUALLY.
On the favorite tracks data type you may also want to put a data field for user to relate the two data types.
THEN, on the user data type you will have a data field that is a list of favorite tracks…so you relate the favorite tracks on the user datatype as a list…this way you can easily save each track and the description individually and then later run a workflow to add all the individual favorite tracks to a “list of favorite tracks” on the user datatype.
You can use this relational database concept all over your app to making saving/editing/displaying/retrieving/deleting data easier…it’s like creating an entire brain neural network, so that you can get any data type from any other data type anywhere in your app.
To this regard, my biggest concern was data storage fees, but bubble says the only things we are charged for are images and files, so when creating relationships, it has no consequence on the costs of data storage.