Hey all! I’ve been scouring old topics trying to find the solution to my conundrum. I didn’t find what I needed, so I’m hoping a weweb/supabase guru can help.
My situation is that I have two select dropdowns. The first select dropdown displays a list of sports teams attributed to the authenticated user. This is stored in the user’s profile table as an array which is mapped to the dropdown. Simple.
The second dropdown however is the issue. For UX purposes, I only want the second dropdown to display teams where the “league_name” matches the team from the first dropdown.
The sports team array attributed to the authenticated user only has the team name in plain text with no other reference to the full team record which would have the “league_name”. So basically I would have to do a lookup of the currently selected value in the first dropdown to find the league name and then filter the teams mapped to the second dropdown against that value.
It’s simple to reason out in my head, but I’m hitting a wall with execution. If anyone can assist that would be fantastic.
one profiles table with a list of users and a column that includes a list of teams in text (no ids, no reference fields)
one teams table with a list of sports teams and, I’m guessing, a column that includes the same text as the teams column in the profiles table
Is that correct?
If so, I’m thinking it would make more sense to have a reference field with the ids of the teams in your profiles table instead of just text because having just text is likely to cause errors in the future.
Thanks so much for this! You’re right, using the uuids is much better. Not sure why I did it with plain text, let’s just call it a brain fade. Im hoping to ask one last question, I don’t want to flood the board with a queries if it’s a dumb question (lol). Last night, when I was using the plain text I figured out how to add that to the teams array in my user profile. I didn’t pay attention to the formula I used, and I’m going mad because every iteration I can think of to try keep simply overwriting the previous item in the array instead of being added to it. Even the AI coPilot just wants to create a new array.
Do you know what I’m missing?
Thank you for all that you do and you’re incredibly helpful tutorials on YT.
Haha I’m not sure what you mean but don’t worry: please do create a new topic. You will not be “flooding” the community. On the contrary, having one topic per question will help others find the answer more easily if they have the same question in the future