Help with creating a thing if doesn't exist/recalling if it does?

Hello, I’m having trouble creating the bones of my program lol. I want a user to search for an address and be directed to a page with reviews on that address. Right now I have a geographical address search, and when initiated it will create a new thing (address) and push the data from that step to the next page (to display the address name). However, it will create a new address every time, and I can’t figure out how to make it only create if it doesn’t exist. Any help on how to do that as well as how to recall the data for the address page? Also if you have any other good tutorials or info related to my idea, I’d appreciate anything haha. I just switched from Adalo so I’m still getting the hang of Bubble. Thanks!!

Hey Nolan,

You would have to add a “only when” in the workflow. In this case Only when: Do a search for “Address” doesn’t contain the new address.

You can send the data to the other page by sending more parameters to the page. Name the parameter Key “address” and the value should be the address you want to send. You have to dynamically map it.

On the other page, you have to find the value address in the url with the “get data from page url” function. The key/parameter would be “address”.

Let me know if that helped you out.

Cheers :slight_smile:

1 Like

Hey! Ok so I believe I got the url parameters down, so firstly thank you for that! But I’m having quite a bit of trouble with the only when condition in the workflow. I feel like I set it up logically but I keep having to extend the condition and it gives me an error saying it has to be a yes/no

Then I tried this setup:


Which I thought maybe could work, but it keeps creating new things even when there’s already one created. Any help on this? I’ve been messing around with it for a solid hour and I’m still very confused haha. Thank you again!

The reason the conditional isn’t working is because the place’s name is a text, not an address data type.
With the conditional statement you have currently, its saying “only when all the addresses doesn’t contain the text in the searchbox” Since an address is a data type and not a text, it’s not going to work.

Instead you would have to count if there are any address data types that have the address that is written in the searchbox.
So do “Only when: search for address where the constrain is → address name = searchbox’s typed text:count is 0. It’s important to use " 's typed text” instead of " 's value".

For example, if in the searchbox is written “Miami Beach Blvd” and they search, the workflow is going to search all address types and see if there are any addresses with the name “Miami Beach Blvd”. If it counts 0, then it will create a new Address. If it counts a number that IS NOT 0, it will not create anything.

You could also do this only when condition: do a search for all adresses:each item’s place name, doesn’t contain “searchbox’s type text”

Not quite sure which would be better for performance, but my go-to is the count method.

Let me know if that solved your issue,

Cheers :slight_smile:

1 Like

Yes that worked! Thank you so much, especially for helping me understand why it wasn’t going to work/will work. It’ll definitely help me in the future. Thank you!!

1 Like

Anytime!

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