How to create a ting if it doesnt exist

I have seen in a lot of tutorials the option to create a thing if it doesnt exist, but i cannot find it anywhere. I am trying to +1 to a value in the database if the record I want exists, if it doesnt exist i want to add it to the database. Below is a screen shot of the debugger that says “create if thing doesnt exist no” I would like it to say yes.

I am updating OK, but not writing new entries.

Hi there, @sdfroggatt… there are a number of topics in the forum about that option being deprecated years ago, and Bubble’s documentation also mentions it…

As the documentation states, you will likely want to add a step to your workflow to create a new thing only when the thing does not already exist.

Hope this helps.

Best…
Mike

Hi Mike
Thanks for that, however I am not sure how I go about checking if a thing doesnt exist before creating

Ive tried doing the following, however it seems to update the entry which is already present, then it creates a new entry

Make sure your search in your Only when condition has a constraint where ST-SKU = Input SKU's value. Then, remove :first item’s and everything after it and replace it with :count is 0. Finally, add an Only when condition to second step to make changes only when the result of step 1 is empty. Give those changes a shot and see if you get the desired result.

6 Likes

Thanks Mike worked a treat

2 Likes

@mikeloc I tried your approach, but still things with type Lesson are created.
The fields on the Lesson that should be checked before a new thing with Status = Ja (yes) is created, are Full Name, Date and For Course. If no entry with these fields with the respective values exist, a new Lesson entry should be created with Status = Ja (yes)

Can you see any error in the screenshot attached?

Help highly appreciated :slight_smile:

2 Likes

Solved the problem for me as well. Thank you.