Forum Academy Marketplace Showcase Pricing Features

How do you pull data from a connected Data Type (table)?

This is insanely straight forward and I can’t seem to get a straight answer anywhere that works. It’s a super simple request.

I’m giving a hypothetical sample to keep this super simple.

Imagine Table A has one record with one field labeled Color and one field labeled HEX. In that one record for the field color the word Red appears and in the HEX field the text #FF0000 appears .

Imagine I have another Table B with many records. One of the fields is Color. I set that field up to link to Table A (cannot recall Bubbles terms for this but I do this exactly as shown in Bubble’s video).

Now imagine I just want to pull one record from Table A and I want to know what is in Field HEX (which is connected to Table A). Basically I want to see the result of #FF0000 . How in a dynamic query do I do that? I’ve tried a thousand times to add the constraint Color = Red and I’ve even done Color = The primary key number.

Nothing works. I’m beyond baffled there isn’t a video anywhere showing how to do this.

I’ve spent a lot of time learning Bubble (weeks) to get to this game stopping problem that doesn’t have a simple answer. What am I missing? This seems like a terrible oversight in the training videos because this is THE reason a relational database is so valuable.

Here’s my editor link, I kind of put together what I think you are trying to do?

There is edit access so modify it if it’s not correct and I can try to answer your question

Check the database structure and also hit Preview to see the car BMW with the red color

Changing primary key doesn’t actually do anything other than helps when looking at the database

I made a basic interface to make colors, then a spot to make a Car and pick a color

1 Like

I really appreciate this, but I want something as simple as a text element showing the value based on putting in the constraints. I’ll take a look more deeply, but didn’t want to lose you if you could give that example. Just one text element showing one Hex value but doing such based on constraints for the Cars Data Type you made.

I added a dropdown where you pick a car and it tells you the hex value of it’s Color. Is that what you’re looking for? When you say

I’m not sure what constraints you’re talking about

Feel free to recreate what you did on your end if I’m not even close to what you’re trying to do :joy:

Right in that text element I added that says “Put result here”

The question is, result of what? The creation of the color?

I want to be able to constrain to the blue car (normally I’d have several constraints, but we’ll keep it simple).

I made it so you pick a color from the dropdown and it filters the search by that color. Maybe that’s what you’re looking for?

No. It’s several steps more complicated. To reverse engineer already introduces new challenges. Can’t it just go in that text element. Just that simple result.

What is going in the text element? If we have multiple cars, and multiple colors, what do you want to show up in the text? Do you mean you want to click a car and tell us the HEX value of it’s color?

My ultimate use case is quite complex. I just need to know how to get to a specific value in a linked table (which you can do quite easily in an SQL string sent to a database via having the tables in the SELECT statement and constraining via the WHERE statement). I’m guessing bubble is so different there are intermediary steps and things bubble does that I do not understand and I’m not seeing an example anywhere.

That said, I’m working on trying to reverse engineer what you did and it’s helping as I look through it. Not there yet with fully understanding, but your help is greatly appreciated.

How do I create a page like you did that you can see? Maybe I can show you specifically where I’m stuck, even when trying to replicate what you’ve done.

Also, can you please keep up what you’ve done so I can try to work on this tomorrow? I’m going to bed soon (it’s 11pm) and I’m doubtful I’ll have this figured out soon.

Under Settings page then the General tab you can change your editor to view or edit permissions. Then just copy paste the link in your browser. What you’re saying sounds possible I think I’m just not understanding what you’re looking for

Yea send the link real quick and I can look at it now

Ok. I figured out how to replicate. But only in a repeating group that then also has a group nested within it. Clearly that is critical. Which I’m not wrapping my mind around yet. I need to go to bed and will revisit to think it through to figure out how bubble’s logic works. I’m sure the answer is in there.

You’ve been insanely helpful. Thank you.

Yea no problem just let me know. I think the part I’m not getting is you’re asking for a specific value, but you first need to find the thing in question in your database before getting that value if that makes sense

Imagine that instead of a hex value I needed to get to a number that I’m using as part of a calculated value.

I know I first have to narrow to a specific record (thing) but I’m not able to do that via constraints on the dynamic expression. The expression isn’t recognizing, for example Color = Red. It wipes out the word Red when I type it in.

Yea show me on your app or re-create it on mine when you get a chance cause clearly I just don’t know what you’re trying to do :laughing:
On my app I added a search box for searching by color, not sure if that’s any closer to what you want. Or maybe you mean you want to search for Red, and get the first car that is Red?

What you’re describing sounds entirely possible it just needs to be translated to Bubble basically