How to return a Thing by User reference?

I need to display data in a group. Staff that has a User’s email (an app types that email in a search field)

I have the following DB structure to search in:

Table: Staff with a field User (type User), basically a reference to User table.
Table User. Just default User table in bubble.

User types in an email, I need to Do search by email and return respective Staff record, first item.

I tried so many variants to accomlish it with my good old friend ChatGPT that I lost count. Looks like ChatGPT failed this time (so far its expertise was enough).

Community, plz help!

Please provide some screenshots of your data source (also, the bubble documentation is really well made for things like this. It even has a very powerful search. Have a quick Google of ‘bubble docs’)


Thanks for providibg the screenshot. Before discussing the fix:

Recap… (read carefully)

  • User Rer is of type USER
  • input email is of type TEXT

when doing a search, you must search for a data type. You’re searching for users, which is great.

The next thing you tried is to add a constraint. You want to get the user who is the user ref. You’re using an input email to match the email to the user ref. The problem is, that when comparing a data type to an input you need to make sure that both things You’re comparing are the same type. Right now, you’re comparing input email (which is of type TEXT) to a field called User Ref (type USER). because USER and TEXT are not the same type, bubble will throw an error. This is normal.

What you’re really trying to do is compare user Ref’s email (which is type TEXT) to the input email (type TEXT). This will work.

In conclusion …

  1. You must always compare two things of the same type.
  2. TEXT and USER are incompatible, i.e, not the same
  3. To fix, compare to User Ref’s email (TEXT) to input email (TEXT).

If you’re still not able to get it to work, please read this article and watch the linked video:

https://manual.bubble.io/help-guides/data/the-database/finding-data

No, it’s email
input email

Suppose I change Input Email to TEXT. How to change User Ref to TEXT?
This is confusing.

User ref is a USER (that is an object with many information) and your input is an EMAIL (basically a text).

That is why Bubble is telling you this constraint is invalid. They will never match.

What you have to do is:

User ref = Do a Search for User:first item

Constraint the search above by user’s email, and use your input’s value.

DONE! Thanks! @ rpetribu

1 Like

Hey there,

The content format of the input isn’t really relevant. Have a look at your user object (the screenshot you sent me)

What you’ll see is that email is of type (either email or text, but they are essentially the same thing).

The problem you are facing is exactly as I said: you must compare two of the same types. Right now you’re constraint says User Ref = input email’s value. This is incorrect.

The type on the left of the = is user. The type on the right of the = is email. You can’t say find me the user that is equal to this email. That doesn’t make sense. You need to say “Find me the user who’s EMAIL is this EMAIL (the input)”

I strongly suggest reading the article I linked as if you read that and watch the video then this question will be solved.

Cheers