Cross referencing

Hey everyone, i’m stuck on something i’m pretty sure should be possible. Hope y’all can help!

I have a workflow that pulls 2 lists (Leaguename & LeagueUrl) from an outside API & saves them to the User. I then have a dropdown which lists all of the "Leaguename"s. When a Leaguename is selected in the dropdown, i’d like to be able to reference the matching LeagueUrl.

Seems like this is possible, can anyone help?

Without knowing more details on your data structure, 3 options come to mind:

  1. Is the Leaguename dropdown being populated by the API call? If so, you should be able to reference the Leaguename dropdown’s value’s LeagueUrl.

  2. Also, if the Leaguename dropdown is being populated from your list of users and you are storing the correlating LeagueUrl on each user, then you can reference the Leaguename dropdown’s value’s LeagueUrl.

  3. Finally, if the Leaguename dropdown is being populated from your list of users and you are NOT storing the correlating LeagueUrl on each user, then you should be able to make the API call again and filter it by Leaguename = Leaguename dropdown’s value.

Thx for the suggestions.

Here’s how my data is structured.

here’s the workflow that brings in the data:

Based on your reply I set up the dropdown like this:
Screenshot%20(59)

I think this should work, but now my dropdown displays the “LeagueNames” as one single option (all the names separated by commas), instead of multiple options.

Maybe my data is structured incorrectly?

So what is happening there… You need to set the Type of choices to Text and Choices source should be Search for Users’ LeagueNames. As it is now, you are pulling all the League Names into one single option so the dropdown is displaying accurately.

I do think you have a data structure issue. Once the lists are saved to the User, there is no correlation between the League Name and the League URL.

Is there a reason you are saving it to the User instead of just populating the dropdown?

If you like, message me a link to your editor and I will take a look at it.

ah, my hunch was that there wasn’t correlation in my database. Being somewhat new to bubble, i wasn’t sure if it was supposed to look like a traditional spreadsheet/database.

I was saving everything to the user because i thought that would be more efficient. I will eventually be using that data in many different places & figured the app would run faster if I imported everything once rather than doing an API call every time i need the data. Maybe that’s incorrect?

OK, It’s working if i populate from API call. I’m just concerned that now i’m doing API calls (in corresponding table) every time the user changes the dropdown selection, instead of one call to load up data.

No, you should be seeing just one call when the dropdown loads. At that point Bubble has all the data and is simply referencing it when the dropdown’s value changes. Obviously on page reload the API will be called again but that’s what API’s are for :slight_smile:

1 Like

Ohhh… ok I didn’t realize that bubble is storing the data from that call.

I’m recreating a tool that I made using Google Sheets as a backend (all calculations & API calls in the spreadsheet). It was so so so far beyond what Sheets could handle, once the user load started to increase it would just freeze up. Now i’m scarred!

Thanks for the help!

I hear you on that! Depending on how often the data changes, you could create a data type for your Leagues that has two text fields for Name & URL and import all that data into your actual database.

Then set up a scheduled workflow that would reach out to the API and update that data as often as you like but your users would be interacting with data directly inside your app instead of the API.

Good luck!