Forum Academy Marketplace Showcase Pricing Features

Setting up database relationships - Data type "user" not working

Hello - I’m building an app where users will submit their blood pressure readings to “batte” each other to see who can lower and our maintain their blood pressure goals.

There’s two tables in the database “users” and “BP readings”

All BP readings will be associated with a user. Thus, in the BP reading table I have a “User Name” field and the type of that field is “User”.

In the User section, I have two users.

The problem is that when I try to add entries to thge “BP Readings” table, it will never save the user name. It always says “Change search field” right below the input section

And then it brings up this screen.

I need to be able to save the readings and then show the readings for specific users for obvious reasons.

I feel like I’m missing something very simple in here. Any idea?

I recommend ignoring the user generated field ‘User’ and access the ‘create by’ field instead, unless you have a compelling reason to store it yourself. It’s one less thing you have to manage.

@Scott

Can you tell me a little bit more about what you mean?
What would I do to change my current DB to do it the way you’re describing? I think I understand, but I’m not sure.

I’m guessing that you’re saying bubble already assumes that the User will create any new data in new data types, so it already has a field for this?

When I enter a new record manually, I don’t have the ability to use the “Creator” field. If that’s the case, how could I assign different BP readings to different users?

Think of users, login, signup, and other such functions as being pre-installed with bubble.

As Scott says, unless you have the situation where one user is recording BPs for another user (great idea BTW !) then just use Creator.

Creator will automatically link to the User that was logged on at the time the thing was created. (but see below).

Then you can just do BP Readin’s Creator’s UserName … to show the name.

There seems to be some confusion over “User” and “User Name” in your set up. The User’s name is field on user, so having a field called User Name set to User seems a little odd. It isn’t the user’s name, it is the WHOLE thing from tthe user table.

The issue with using Creator is that it doesn’t work very well in the Data view, as it requires you to be logged on. You would need to create the page in the app and set up the logon for it to work.

The set up you have, with User Name, would work in Data View, you have set up “User Name” to search on email address as a field (thats the “Primary Display Field” box, so start typing an email address and you will get a list of users, select on and it will allocate it to the BP reading.

Thanks @scottb50 and @NigelG this is very useful. I don’t completely understand what you’re saying, but I’m getting the gist of it. It will just take more playing around to really understand the database relationships. Eventually it will click! Just takes play and patience.

I decided to scrap that old database structure and I’m building a new one. I’ll be in touch with my questions on here.