Forum Academy Marketplace Showcase Pricing Features

Set state isn't working to store a value

Greetings,

I am throwing together a Gig tracking app, as such I want users to be notified when new tours are added. To begin putting the building blocks of this together, I searched the bubble forum and found what seemed to be an ideal solution.

The idea is on page load, it will set a state to a number, that number being the number of tours the user currently has saved. If a new tour is added for that band, a separate workflow will run which checks the total number of tours for that band against the number the user has saved, and fire an alert if they are not the same (i.e “A new tour has been listed!”).

But I seem to be falling at the first hurdle and not sure why as it seems like it should be straightforward.

This is the workflow for page load to set the state:

This is how the data looks in the database for user:

image

And how the Bands Tours look:

image

My initial tests weren’t working as expected so I just put some text boxes on my page so I could visualise the numbers being stored as such:

image

And this is what happens when I run it:

image

So as you can see, the textbox shows that the number of tours for that band is 5, which is correct, and is the same expression that is used in the page load workflow to set the state, yet when the value of the state is printed, it’s showing as 1, when it should be the same i.e 5.

I’m sure there’s something very obvious that I’m missing but not sure what that is as thought this was pretty straightforward and should be working as stated.

Any help would be most appreciated.

Thanks!

Have you tried running the debugger to see how and why the state value is being set to 1? That’s the first thing I’d try - it might give you an idea of where the problem lies.

Good lord I’m an idiot - yes the debugger showed exactly what I’d done wrong - had a separate step in an alert workflow which reset the number after the notification, but instead of tour number had it set to band name i.e there’s only one of those!

Thanks!

1 Like

Glad you found the issue