Update datatype but not allow duplicates

Hey!
I have done all the bubble tutorials now and i. have learnt A LOT, differently recommend. However,
Been trying the whole day to figure this out, been trying to follow other tutorials on the forum with the same problem and nothing is working.

I want a user to type in a Color, that color will be added to the database but when another user types the same color it won’t add a duplicate to the database nothing will happen.

Scenario 1: I can type colors and duplicates are allowed and stored in the database

Senario 2: I can type colors but nothing i submits gets registered in the database…

Use a conditional (only when) on the workflow or workflow action.

Then do a search for ‘colours’ to check the database to see if an entry already exists that matches the input’s value.

If it doesn’t then allow the workflow to run and create a new entry.

If it already exists then don’t let the action run. (instead you can show a message stating that the colour has already been chosen).

I have tried that, and it does not work…?

Your condition is incorrect. Change the 1 to 0…”is 0”

@shawnmi6 When i set it to “is 0” nothing i type gets to the Database no matter if it already exists or not…?
:pleading_face:

Post a screenshot of the whole workflow, and search constraints, so I can check - you must have something set up wrong.


@adamhholmes

What are your search constraints (on do a search for color)?


Do you mean these?

no, in your workflow action ‘create a new colour’, on your ‘only when - search for colours’.
What constraints do you have on the search?

Oh sorry @adamhholmes i know now what you mean, no i don’t have any search constraints, what would they say?

you need to set the ‘colors’ field to = input what’s your guess value

1 Like

YES NOW IT WORKS! thank you so muc @adamhholmes!

Why is it that they have to me the same?

Because what you’re doing is…

creating a new ‘ColorVault’
but only when there isn’t already an entry in the database that has the same ‘colour’ value as the value entered into the input.

So your ‘only when’ condition is searching the database (do a search for) for all ColorVaults where the ‘color’ field is the same as the value entered into the input.

Then, if that search finds no existing records that match the input’s value (i.e. the count is 0) then the workflow will run and a new ColorVault will be created.

If the search finds that there IS already an entry that matches the input (i.e. the count is anything other than 0) then the workflow won’t run.

If you do it without the constraint (as you did), all you’re doing is searching for ALL existing ColourVaults (of any color), and if there are any more than 0 in the database then the workflow won’t run (as you experienced).

1 Like

Okay! Thank you so much for helping me and also explaining! Means a lot, and I learned a lot as well! :smile: :clap:

1 Like

Hey! trying to add two popups, one for when a color is not taken and one when the color is taken but i can’t get that to work either… :rofl:

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