Forum Academy Marketplace Showcase Pricing Features

How to make a change in value in one database reflect in another

Greetings,

Am new to no-code/bubble.io and decided to start a project to get to grips with how things work.

I am making a gig tracker i.e get alerts when a band is touring near you sort of thing.

I have a workflow to create a new band where details of the band are input (i.e band name, genre, bio) the details of which are saved to “Band” database.

I then have a workflow to create tours for that band (country, city, venue etc) which are saved to “Tours” database.

I also have a workflow to edit details about a band (i.e maybe they change their name, alterations to their bio etc). When the edit button is clicked, a pop-up is shown whereby the user can modify the details of the band accordingly. I have the workflow set up and functioning in so much as it updates all the modified information.

However, if the band name changes, then if I use the function to view tours for that band, nothing shows up, because the Tour database is unaware of the name change and thus lists nothing for them under their new name.

My edit-band popup has “band” type content sent to it, and the relevant data pushed to it via workflows. So it seems I cannot simultaneously push tour data to it as well to then figure out a way to also change the name of the band in the tour database when it is changed in the band database.

I’ve stared at the screen for a few hours to try and figure out how to solve this but not coming up with ideas. I’m wondering if the way I have structured the system is fundamentally flawed and needs redesigning, which would be a shame since I’ve put quite a lot of work in to make everything function as it does and I’m happy with how its progressed so far.

But if there’s a way to make it such that when I save changes in the edit-band pop-up, I can subsequently make the change to the band name in the Tour database such that it retains all the other information about the tour, then any ideas on how to do so would be greatly appreciated.

Thanks.

Welcome to Bubble :slight_smile:

The cool think about Bubble databases is that it’s really easy to create relationships :slight_smile:

So on your tour data type, create a field called Band and make that type ‘band’

Then when you are showing details of the tour, you use the expression ‘Tour’s Band’s Name’ to display the band name (or same logic to pull anything from the band data type).

1 Like

Nope that’s not what I’m saying :slight_smile:

You can create a field on a data type that is the ‘type’ of another data type. This is how you link 2 data types together creating a relationship.

So for instance you could have the data type Band, and under Band you could have ‘manager’ and this is the user that logs in and manages all the band details on your platform. So this field under Band you’d set to be type ‘user’ and then on the user data type is where you have all the actual Manager’s details (name, email, number etc)

Similarly you can have data type ‘tour’ and then on that data type you set a field with type ‘band’ and under band is where the name etc is stored. So when you update the name field under the linked Band, you can automatically (dynamically) access the new Band name.

I’d suggest doing some Bubble lessons and maybe even looking at the Bootcamps as database set up is crucial to a well functioning app - and knowing how the relational database works and how to set it up is the key to that :slight_smile:

I was meaning to respond to the original poster, not you. My apologies

If I’ve understood what you’re trying to do, one way to solve this (speaking only functionally) is to update your database schema (structure) to have a second field for the band name, such as “Previous Name.”

Now, when a band changes their name, you’ll need to store both the new and previous name. I can’t tell you everything to do, but essentially you’ll need to use both Name fields in a search request. The tricky part is a band may go through a few name changes. So you’d actually need a list of previous names, and you’ll need to update workflows to account for that.

A possible partial implementation works like this: When a band FIRST creates an entry, save their name to BandName (e.g.,) and to a list of PreviousNames (e.g.,) simultaneously. Make it clear to users that if they change their name, they need to specify and confirm their previous name for Tours.

I found this page, and there’s a hint in there that might help. Basically, it says that you can create a workflow based on a condition such as “do X when user has typed in three characters.” So that should also work for one character

https://manual.bubble.io/core-resources/elements/conditional-formatting

Hi thanks for the reply.

I am still struggling with this.

Will probably help if I explain how I have things set up in terms of how the database is constructed.

When I am adding a new tour, the band to set dates for is selected from a drop down menu

.

The workflow for the “Add Tour Date” button sets the band name for the tour based on the selection from the drop down menu.

When I display current tours, the user selects which band they want to see a tour list for again via drop down. The repeating group has Tours as content type and Search for Tours as data source, and then a constraint to limit it to only display tours for the band in question.

If I then set the first text cell to display current cells Tour’s Band Name, then it works inasmuch as it shows the details accordingly.

So the problem comes when I edit the name of the band, because the cell is taking its data from the Tour database, and since it doesn’t “know” about the name change, it won’t display anything.

Taking your suggestion, if I change the first cell to display the Tours Bands Band name, then when previewed the name field shows up blank (the other fields show up fine since they have not been altered).

This is how the databases are constructed.

Band:

Tour

I was thinking that maybe I need to somehow alter the workflow for when edits are saved, to modify the tours name field, but can’t figure out how to do that either.

Its really cooking my brain trying to figure out how to do this.

Thanks for any help.

Ok, I think I solved this. After another couple of hours going around in circles.

I removed the “Band name” field from the Tour database as this seemed to be duplicating data and confusing things further.

I then had to alter my workflow for the “add Tour” function to make “Band” equal the relevant selection.

After this I used Current Cells Tours Band’s band name in the repeating group.

After doing this, after creating a new tour entry, it shows up when viewing tours. But crucially when I edit the band name, this is reflected properly when going back to view tours under their new name.

Only thing throwing me off slightly is that when I view the app data, the “band” field is filled with…what I assume to be reference code of some sort - presuming this is normal and nothing to be concerned about. I mean, functionally it works but wondering if its working “in the way it should” so to speak - just wondering if I may run into problems further down the line if this isn’t supposed to be what’s happening. Example given here:

Yep - you got it :wink:

That number is the unique ID of the associated band, so it’s normal :slight_smile: You can change what’s displayed there by clicking ‘primary fields’ button at the top of your database.

Thanks for your help. On to the next headache!

1 Like