Hoping to get some thoughts on how best to set up this data model.
Context - I am building a fantasy sports app and I have 3 data types:
KEEPER
-Player name
-Position
-Cost (numerical)
KEEPER SET (users can group KEEPERs together to create one KEEPER SET)
-KEEPER
-TITLE
-DESCRIPTION
DRAFT (each draft will include a KEEPER SET)
-KEEPER SET
-DATE
-etc…
–
Where I’m struggling is how to a) best set this data model up and b) how to interact with Bubble. For example, I tried to add a new database entry for KEEPER SET (see screenshot) but am running into this weird search field:
Secondly, what I’m struggling with is how to associate the various KEEPERs to one KEEPER SET. I’ve set up this checkbox UI but am struggling of how to modify the workflow, but I think I need to be confident in the underlying data model first. Any help would be appreciated!
Ok I’ve modified the KEEPER SET, KEEPER field to be a list…
What I mean by the weird search field is that I would try to add an entry, but then nothing happens - it blanks out (see below). This happened whether it was a list or not.
Your database structure looks good to me. If you’re having trouble filtering Keepers by Keeper Set, don’t stress - it’s a weird Bubble thing (it is easier if you set the relation on both tables, but it is less practical).
Here’s what I’d recommend using for the RG’s data source:
Do a search for : Keeper Set (List of Keepers contains [Keeper])
I’d recommend using checkboxes only if you add bulk actions above the table (rather than the three dots slotted for each record). For a bulk action, here’s what I’d set up:
Workflow(s) for checkbox
Add a custom state called “selectedKeepers” with type Keeper (list)
New workflow (only when: checkbox value is changed (checked) → change selectedKeepers → add Current row's Keeper
New workflow (only when: checkbox value is changed (unchecked)) → change selectedKeepers → remove Current row's Keeper
Workflow for bulk removing Keepers once the user has selected one or more Keepers
Make changes to a Keeper Set: Keepers: Remove list: selectedKeepers
For removing a single Keeper from the Keeper Set, I’d recommend a GroupFocus that references the three dots icon. When a user clicks “Remove” (from the GroupFocus menu), it removes Current row's Keeper from the Keeper Set.
From the database, you cannot create a new Keeper - this is a relation field, meaning that you can only add a Keeper to the Keeper List that already exists. If Jalen Hurts has already been added to your Keeper table, then you’ll need to make sure the field is mapped to the player’s name (Bubble defaults to unique id) and click “Add”.
Thank you! I hadn’t considered using states. Let me take a read through of this more thoroughly and try out some of the solutions - I might have some follow up q’s but thanks again
I even tried to add the KEEPER’s unique ID to the existing database entry’s search field but the same thing happens where nothing occurs after clicking ‘Add’.
So on the Table (using table instead of an RG), looks like I was able to figure out how to bring in the KEEPERs using some of your advice + some trial and error:
Where should I add the custom state 'selectedKeepers"? My assumption is that I should I do it on the Group Container containing all the KEEPER elements, but I’m not 100% sure.
on your point #2 - the new workflow should be triggered when? I assume when the button “Add to Keeper set” is pressed?
Same question for the workflow for removing Keepers - I assume there should also be a button that says “Remove from keeper set”?
It’s a learning process - thanks for the screenshots and sharing updates as you build!
In terms of where to place your custom state, although you can place it anywhere, I recommend placing it as high up in the hierarchy as possible that will be easy for you to remember. This can be for the entire page or a Group that is intuitive for you (wherever you won’t forget about it).
To clarifiy about the workflows, I didn’t mention how to add Keepers (only how to delete 1 or many at a time in a way I thought intuitive for users). To add a Keeper to a Keeper Set, it would be the exact same process, except you’ll use “add list” instead of “remove list” for bulk actions and “add” for single actions.
Could you explain what the user flow should look like? I’m not 100% sure how Keeper Sets work since there are already Drafts.
When they select ‘add to Keeper Set’ - a list of already existing Keeper Sets should appear. A Keeper can belong to multiple Keeper sets. They can also separately create Keeper Sets similar to how they did Keepers in a different step:
A few things I’m struggling with:
-How to set the custom state. Should the custom state be on the KEEPER or KEEPER SET object?
-Is this the simplest way to accomplish what I’m trying to do?
Any insight would be helpful from you @Keymaker or anyone else!