Conditional create / append / remove

Really struggling with the ‘Only when’ function, hoping someone can help as I can’t find detailed documentation on this.

My web app allows people to create travel itineraries. Structure is as follows:

Users
Destination ID
Activities

The app does not allow multiple itineraries for a single destination. So what I want to achieve is:

CREATE a new destination ID ONLY WHEN the input destination ID DOES NOT exist FOR the current user.

The only when functionality is a very important part for me to avoid duplicate entries, I don’t want people creating 4x different New York itineraries or adding 5x Staten Island trips to each itin.

Help appreciated!

@nickwhiteishere

The condition would look like “only when Search for Destination:count is 0”
Make sure to include the following constraints in the Search for Destination:

  • ID = Input ID’s value
  • User = Current User

Let me know if that works

Thank you so much. Managed to get that working.

I’m also trying to create a different function that I could really use help on, if you’d be so kind! :slight_smile:

I’m completely unable to run the delete functionality at the moment and, once again, can’t find sufficient documentation:

What I’m trying to do is search for a database entry and, if it exists, delete it.

Managed to get it working now! I needed to add a step in order to tell Bubble which if the returned values I wanted to delete.

If anyone knows of a good resource for using conditions and searches within Bubble please let me know. Really struggling with learning resources in this area.

@nickwhiteishere I just saw that, didn’t receive a notification for some reason. Glad you got it working!