Make change to a thing in a database using value from another database

Hi there, I’m still quite new to Bubble and I’ve been struggling for 2 days now with something that looks quite simple. I have a database called “Matches” in which sport matches are being recorded. As the match gets created in the adminpanel (click on a submit button), an API workflow is triggered and several fields are being populated in that database e.g. Player1Name, Player2Name, Club, Date, etc, directly using the values inputted by the admin through the dropdowns. All of that works well. However there is one field called “MatchStatus” in the Matches database, for which there is no value directly inputted by the admin. The value should be automatically set to “Scheduled”. I have another database called “MatchSatuses” in which there are 4 entries. In the field “StatusName” there are the following values in the 4 different rows: “Scheduled”, “ScoreEntered”, “Closed”, “Simulated”. I’m trying to get the “MatchStatus” in “Matches” database to be automatically set to “Scheduled” through the API workflow when the match is created. I’ve been trying to do a search through MatchStatuses database and put a constraint for StatusName = Scheduled but the StatusName values don’t appear in the dropdown in the editor and I can’t manually type it in the editor. I’m lost on this point and chatgpt cannot help me. Can someone please help shed light on this ?

1 Like

Make data default value to scheduled.
And for your other queries you need to provide screenshots to clarify.

@siddharth Thank you for the quick reply. Makes sense, that can work. However, I will still have the same problem when I want to change the value from Scheduled to ScoreEntered later on, for example. Here are some screenshots. Thank you very much for the support!

You can see that in the editor I cannot find any of my values existing in MatchStatuses database.




It should be Matchs>MatchStatus>MatchStatutes>StatusName

Can you please elaborate? :pray:

Because you are setting dynamic values that’s why you can’t manually type it, just hover your mouse after the equal sign so you can enter static text like “Scheduled”.

But the status should be dynamic as it is pulled from a DB that has 4 potential values: Scheduled, ScoreEntered, Closed, Simulated

I don’t know why you have created a DB StatusName it doesn’t make any sense, when you can easily do something like, when match is created set the StatusName = Scheduled, then if the match is already ended then set StatusName = Closed, and etc. If you want you can use Option Sets.

Hi,
I think you can solve this in 2 ways:

First.
Here you could Do a search for All MatchesStatuses with the constrain be StatusName = Scheduled > First Item > SatusName

Other way is apply this Status as OptionSet

image

Second

If you want to change a DB field from another DB field, one the best way is use Data Base Trigger Event from Backend Workflow

You can set the condition - Only like, like this:
Matches before change Player1Name is not Matches now Player1Name.

In other words, when there is a Player1Name you can trigger a action.

I hope helped you

@yamada.shoji99 and @dualpixel Thank you. Option Sets indeed seems like the best way to go. I’ve implemented it successfully. Have a great day and thanks for the support!

2 Likes