Gathering duplicate data but only saving one of each

Hey! So I have quite a specific workflow/database flow and I have it working but I’m almost certain I’m missing an easier way of doing things, I’d love any input if someone has some ideas :slight_smile:

So I have 2 databases - One is the ‘album’ database and the other is the ‘tracks’. So the user can create an album then create the songs that belong to that album. Each song can have different artists. See below:

The weird workflow issue I’m having is, I want to collect all the artists that have been inputted in the artist fields for the tracks and save them to the ‘AlbumArtists’ field in my ‘album’ database. The issue is - if the album has 20 songs and each song has mostly the same artist, it will just be that artist over and over again.

My workaround is this:

Here I am taking the artist that has been inputted into the first box then checking that the database doesn’t have the same value that is in the box.

This works but it means I am going to have to write 20+ of these ‘only when’ statements to check if the database has that input in there already.

Is there an easier/cleaner way to do this?

Thanks for reading!

Wow, after typing all that I found out that bubble actually doesn’t allow duplicates to be saved to the database. This completely solves my issue and I really should have tested before I posted!