Duplicate Data Entered into the database

HI Guys,

Im having trouble with duplicate entries in the database. Im using the condition ‘if count is 0’ then create the thing. The problem is that if i repeatedly tap the ‘button’ that triggers the workflow the data is entered twice, seemingly in a gap between the data been added to the data base and the repeated clicks. Im thinking this maybe down to lag between the initial clicks workflow running and the data entering the database.

Any ideas of a workaround would be greatly appreciated.

Thanks,

Joe

Hey Joe :slight_smile: Can you share a link to the editor?

Disable the button on the click event and first action of the workflow.

Hi,

How would i go about doing that?

Ive come up with a bodge for know of having an alert appear over the button.

Thanks,

Joe

Here is a forum example of disabling a button on click using custom states:

Preview:

Editor:

In this example, a new Fruit is created using the Input’s value, and the Create Button creates that new Fruit.

The workflow for the Create Button is this:

A New Thing (Fruit) is created:

The next step is to create a new custom state on the Create Button which will not make it clickable after after it’s been clicked once. To create and set a custom state on the button, the action in the workflow is:

Element Actions --> Set State --> Element: Button Create, Custom State: create a new custom state…

This creates the custom state (Clickable State) on the Button. Then the value is set to “no”.

The last step is to edit the conditional formatting of the Create Button to not be ‘clickable’ when the Button’s Clickable State is “no”.

And that will disable it, unless the page is refreshed or if a different element action sets the Clickable State value to “yes”.

3 Likes

Sorry for the late reply. That worked 100% Thanks!!!

1 Like

Hi @fayewatson :slight_smile: thanks for your help !!

1 Like

This is awesome, thanks @fayewatson! Simple and elegant.

1 Like

Hi @fayewatson, do you know if there is a way to search only for exact data entry?

Right now, if I create a data entry “Product” and then subsequently type in “Production”, “Production” won’t be saved because the word contains the word “Product” in it. :confused:

It might be a good idea for bubble team to add a feature like ‘disable while workflow is running’ that you could check / uncheck on a button like other properties

4 Likes

@bajerlin are you using ‘contains’ or ‘=’ in the search when the button is clicked? It should be = in order for it to bring up only exact matches. :slight_smile:

1 Like

@fayewatson ahh thanks! That was a facepalm moment for me :man_facepalming:

1 Like