How to prevent double entries in the database


My Bubble projects contains an online collaboration platform, which lists users (ofcourse). Each user has a profile, which also contains it’s educational background. Let’s say, I have John Smith and John attended Harvard University.
So, when John add’s his University Degree, the workflow contains --> Add a new thing, type: university (which contains place, degree, etcetera). For all this goes well, except when David Smith joins my platform and David also attended Harvard, I get 2x Harvard University in my database:(…

So, I already changed the workflow to " make changes to a thing: Current users education, and I’ve replaced the input form with a search form (so when a user start typing Harvard it will automatically shows the already available Harvard University in the database).,.

Anyone can help me with this issue?

Thanks! Martijn

1 Like

I’m not sure what the issue is, because it sounds like you already solved it :slight_smile:

I’m guessing that maybe you saved the education as a text field, but you want to change it to a Thing called University, which contains Harvard/Stanford etc? That way, the University will be “linked” to the user’s account, which makes sense from a database perspective.


Thanks for the response, but the issue is that when performing the described workflows, I get 2 results:

  • Harvard University
  • Harvard University (1)
    … and subsequently for each user who adds Harvard University as it’s education…

Could you share the app in the public forum app?

We’ll be back and forth going over how your app is set up, it’s quicker if we can have a look :slightly_smiling_face:

Remember to use “Copy with workflows”.


I really would like, but the copy-paste (page) and/or “copy with workflows” don’t work, since the database isn’t copied also? So, after copying I receive 400+ errors…

I’m currently reviewing the database, but also by looking to this post: Are many-to-many relations supported?

So, maybe it’s an idea to create a new element called “User_education”, which contains “user” and “education”, and that In the element Education I will add the necessary details… ?
Don’t know if that’s the best to set this up, but I need to figure out a workflow that either links a user (like David Smith) to an already exisiting education, and if this education doesn’t already exists, it should be created.
For the latter I used the function “allow items which are not on the list” in the search.

I think you’re on the right track!

If the school does exist which you’d determine if “the search box’s value is not empty”, then the user’s University field = the search box’s value.

If the search box’s value is not empty > create new University: name = search box’s typed text > make change to user: University = result of step 1


You mean by creating the user_education table? Also, the constraints you mentioned are part of the “Create a new thing workflow”. But that’s only applicable when the added Education isn’t already part of the database, because when the Education is already available in the databse, a copy will be added, and then I am back at my first issue of this topic :slight_smile:

I hope I’m following you correctly, but yes, so in order to prevent a copy from being created you’d add a condition to the Create action: “only when search box’s value is not empty”. Therefore, for the Make a Change action, you’d have the opposite condition - only one would ever be true.

Alternatively, the conditions can be placed at the event level so that you have 2 separate events for each scenario (existing Education or non-existing) - to keep things clearly separate as opposed to managing a bunch of conditional actions under a single event.

Ok, I’m still having trouble with making the connection, since I don’ completely understand how to structure many to many relations ( Are many-to-many relations supported?), in combination with a profile page which shows most data by the variabe" Created by the current user" …

So, the idea is that (e.g. just like Linkedin), a company and/or education is added by a user and then is stored in the database.
Also, when using the search button for adding a company/education (instead of input), I cannot create 2 separate workflows (as @romanmg mentions), since I’ve enabled ’ also allow items not in the list" in order to ensure that the user can always type in something.

So, in short, I’ve ruined my database today :frowning:

Hi @hawkeye84, don’t give up! Could you share your editor link? I’d be more than happy to take a look at how things are set up currently and see what needs to be adjusted. We can definitely achieve what you’re describing. I’ve done it many times before with others.

1 Like

Hi, I just send you a PM with a link.

1 Like

I’m trying to understand this - can you confirm if I have this right?

a. If user searches for Harvard and it’s value is not empty (so it found something’) then do this…
b. If user searches for Harvard (and it doesn’t find anything so User types it in) then it’s typed text is not empty and do this instead…

The parts in bold are put in the Only When condition on the workflow Submit button event and have different actions as a result.

Correct. That’s how I do it.

Yes, that’s also what I learned from it.
When a value is NEW --> it’s a typed text…
When a value is already existing. It’s a value…

And the workflow converts types text into values…

Thanks! Works perfectly!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.