Forum Academy Marketplace Showcase Pricing Features

Do I need to use a database 'list' here - how can I set this up in a database?

Let me use an example.

I am capturing all the treatments within a hospital department - each treatment captured will have a NAME for it, TIME TAKEN, a CATEGORY and a DESCRIPTION. The user will be able to create as many rows as they like with these 4 fields appearing for each treatment, so there won’t be any fixed number of rows as each department will have more or less treatments on offer than the other.

How can I set my database up to not only capture this information for each of the treatments, but also each of the 4 fields per treatment?

I thought about using a database ‘list’ but then thought I need to push this data via an API to generate a document, will I come across limitations as I won’t be able to do any complex searches across the list or manipulation of data?

A typical approach would be to have another table like “department treatments”. Which holds
Department
Treatment (with it 4 fields)

So it would have multiple rows of treatments per Department.

Then design the UI so as each Treatment is added, that treatment is added the DB. (to avoid the backend workflow API to deal with adding lists)

Regards using basic Bubble to do a search across a nested relationships of objects - that is another kettle of fish.

https://manual.bubble.io/help-guides/working-with-data/using-algolia

At least that’s how I’d approach it. :slight_smile:

2 Likes

Just revisiting this again after some thought…

So you’d have have table and have department and treatment as the two fields. Then create the 4 fields, and add ‘treatment’ as the type for these fields?

You would have in a data type called Treatments:

  • Field called Name set as text
  • Field called Time Taken set as number (and use the number of minutes in this field)
  • Field called Category and set as either an option set called Categories (you should make an option set called Categories) if this will be a standard set of names for everyone. Or just a text field if this is set at the user level (or potentially it’s own datatype but we’ll keep it simple for now)
  • Field called Department set as ‘department’ data type.

Your department field is then what you use as your search constraint to bring back all the treatments for a particular department