Need help: Struggling with "Make a change to a thing"

Hi,

I’ve been struggling with a simple yet not knowing how to implement on Bubble with egard to make a change to a thing.

What I’m trying to is the following:
I have a data Type called Bookings , and two fields “Name” as text and “Reservations” as number.

I also have two input , one is text “Restaurant name” and one is number “Reservations” and one Button “Submit”

I want to create a simple workflow where user inputs Restaurant name and number of reservations and clicks on “Submit” and the workflow has to go to “Bookings” database and search for the restaurant name and update number of reservation to be existing reservation number + new inputted reservation number (in my example it will look for Mcdonalds restaurant and add 3 so total will be 8)

07%20PM

Appreciate your help with this use case , I’ve been struggling for many hours on this now , also I tried to use the same way of one of the tutorial lessons (To create a voting city app) but It didn’t work as that one requires having a repeating group.

You can think about it similar to order submissions (how to reduce number of stock of the ordered product) similar but in my case I want to add instead of reduce.

Thank you
Majd

1 Like

@majd It should be a ‘make a change to thing’ action as you noted. Find the thing with ‘do a search on Bookings’ with constraint name = McDonalds. Then for field reservation = this booking’s reservation + input reservations value

Keep some things in mind.

Because restaurant is a free input field, be sure the value you check is consistent.

For example: Input can be Mc Donalds, MCdonalds, or MacDonald’s.

So you may have to transform the input to lowercase, with no special characters and no spaces, like: mcdonalds.

Then also when the restaurant does not exists you have to create a thing with a initial amount of reservation.

So you have to define two workflow triggers on click. One based on a condition that executes a ‘create’ only when the the count of your search is 0. And another one that executes a ‘make changes to a thing’ when the count of your search is 1 (or not 0).

Other option is to create and maintain a list of available restaurants yourself with initial 0 reservations. Then users can select or search the restaurant from a drop down, and put in the number of reservations. In this case you can only use the ‘make changes to a thing’ workflow event.

I am not an expert but this is how I would set it up.

Good luck

Thank you @neerja and @FJP for your replies.
I’m still struggling with the implementation of the workflow , as you can see in this screenshot I’m not able to complete the workflow criteria and it keeps showing as red (as in complete).

there is the list of available options when I click on “more”

I tried many of the “more” list options but didn’t work , I’m not sure what I’m missing here!

Thank you
Majd

Hi @majd ,

Try the following:

Do a Search for Bookings and add a constraint: “restaurant = input_restaurant’s value”. Then you get a notification that you trying the change a list of items instead of an item.

image

Click on the button in this notification to solve this. Your thing to change will be updated to: “Search for bookings:first item”

Than you click “+ Change another field”. In there you do: reservations = “This booking’s reservations + 1”.

The final result is:

So to summarise: you want to add “1” to the current reservations of first item that has the same restaurant name.

1 Like

Thank you @FJP it worked using your solution now :slight_smile:Appreciate it.

1 Like

Thanks. Glad I could help

1 Like

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