How to best structure these 3 databases

Hi,

New to Bubble (few weeks). It´s going well and but now I see that I need some help.

Databases (for this question):

  1. Contract (think of them as job offers)
  • Name
  1. Consultant (people that potentially could get one of the contracts)
  • Firstname
  1. Pipeline (who consultant is in process with which contract)
  • Contract-UniqueID
  • Consultant-UniqueID
  • Status (e.g if Consultant is pitched, to interview etc)

One Contract can have many Consultants and one Consultant can have many Contracts.

I am at the stage were this works, I can add Contracts and Consultants and update the Pipeline.

But:

  1. Is this a good structure for Bubble. I tought I should have created a PipelineContract (datatype Contract) and PipelineConsultant (datatype: Consultant) instead of the unique IDs, but I am not able to store both when I e.g add an Contract with the Consultant to the Pipeline database - only the “Parent´s group Contract e.g”

  2. Should I add Contract Name (with the rest of the Contract fields) + Consultant Firstname (with the rest of the Consultant fields) to the Pipeline. This will solve it as I can then just look up everything there - but this seems like a bad database structure (duplicates in Pipeline).

  3. If I keep the above structure I have trouble to understand how to get e.g all Consultants (firstname) related to one Contract. Should be easy in my mind, but not solved it yet (tried alot).

Thank you for the input.

Br,
Thomas

I am NOT a fan of doing stuff like this. I’d rather you just do a search for your Consultant’s name where ID equals the Consultant-UniqueID.

You also open up a slight problem where the consultant needs to change their name. Then you’d need to update all their Pipeline rows with the new name. This would NOT be a big deal, but if you start duplicating data like this for the sake of convenience/performance, you start having to do these types of bulk updates a lot.

Other than that, your db structure seems pretty fine.

This implies that you’re using text fields here to store the unique IDs, rather than fields of the datatypes themselves…

Whilst this will work, it just makes things more complicated (and probably less performant) as you’ll need to make additional searches, and cant access the fields of the Contract and Consultant datatypes directly from the pipeline datatype, without doing additional searches…

Is this a good structure for Bubble. I tought I should have created a PipelineContract (datatype Contract) and PipelineConsultant (datatype: Consultant) instead of the unique IDs, but I am not able to store both when I e.g add an Contract with the Consultant to the Pipeline database - only the “Parent´s group Contract e.g”

This is a better way to do it than just storing the uniqie IDs a texts…

I’m not sure what you mean by not being able to store both when you add a Contract etc…

Surely if you can store the unique ID then you can set the actual datatypes instead…?

Thank you both - really value your input!

Agree, the datatypes should be stored, but how?

Process

  1. I open Group which parent is Contract
  2. Click a button “Add Consultant to that contract”
  3. Popup then appears and one can search for a Consultant in a search input field to add.
  4. Hit the save button.

All good, but then. It´s easy to store the Contract-datatype to the Pipeline database, but NOT the Consultant-database.

Sceenshot below:

Thank you.
Thomas

PipelineConsultant = SearchBox’s ADD PIPELINE’s value

…that’s obviously assuming the SearchBox Add PIPELINE is of type Consultant (which based on the name of it, I’m not so sure it is… but in that case I can’t work out what you’re trying to do at all?!!)…

So, if it’s not a Consultant, then what is it?

Thanks - that worked. Why did I not ever try this - sometimes I think I suffer from brain damage :slight_smile: I tought it would store the input box value (Consultant´s name).

If I stand in a Contract (show contract view) how would you suggest the search for Consultants related to that Contract would be? To list all Consultant for one specific (current) Contract.

Thanks again.
Thomas

Assuming the database structure you outlined in your first post, you’ll need to do a search for Pipelines (where the Contract is the specified Contract): each item’s Consultant (that will give you a list of Consultants)…

1 Like

Thank you so much - that worked!

One last question (I hope). This output was: “Consultant name 1, name 2, name 3… etc” in one long text string.

I sat this up in a Repeating Group with a text field to show the output.

How can this be solved if they can be presented as in each name pr row in the repeating group (as normal with repeating groups).

Thank you,
Thomas

I’m not entirely sure I understand the question…

But, if you’re trying to display the list of Consultants associated with a Contract in a RG, you just need to do the following…

The RG content Type should be Consultant (obviously)

The datasource should be a search for Pipelines (who’s Contract is the specified Contract): each item’s Consultant…

Again, that will give you a list of Consultants…

You can then display whatever data you like for each Consultant inside the RG (e.g. Current Cell’s Consultant’s Name etc.)…

1 Like

Thank you once again - that finally worked.

Final setup:


Thanks,
Thomas

I’m not sure I understand what the second image is meant to be?.. (you don’t want to do additional searches inside the RG cell…)…

If you’re trying to display the current cell’s Consultant’s firstname in a text element, the text should just be Current Cell's Consultant's firstname (don’t do another search)…

UPDATE: tried you input and it worked perfectly - much better and easier. Thank you!

I see that but, I try to:

Pipeline database has:

  • Contract ID (I jus call it that, but it´s Contract datatype)
  • Consultant ID (Consultant datatype)

Process

  1. I first list all Contracts (in an RG). No problem.
  2. Click on a specific Contract and a floating window slides in that shows the content info of the Contract (requirements, dates, deadline, length etc)
  3. In this view I can add Consultant which will be added to Pipeline database along with the Contact-ID (datatype) and the Consultant-ID (datatype)
  4. In the same view I also list all the Consultant names related to this Contract. This is the question/issue.

So I have to make sure only the Consultant that exist in Pipeline for this specific Contract is presented.

If there is an easier/better way I am all ears :slight_smile:

Thanks again!
Thomas