Forum Academy Marketplace Showcase Pricing Features

Trouble with incrementing a value

I am trying to make a cell with

When the + is clicked the value should be +1. The - should do it -1.

How can I achieve this using bubble and how can I add the resulting value to a certain index in a list?

The saving data - Redit type app lesson will give you a basic indication

1 Like

Depends where you “index in a list” is.

On the database, as above.

If you are trying to have a temporary value, then you need to look at Custom States,

I have a list of elements: [0, 0, 0, 0, …, 0].
How could I tell bubble: ‘Hey, increment item at index 0 by one because the + button at index 0 was clicked?’

I’m trying to figure out increment as well. Did you figure out how @EduardIchim ?

Bubble isn’t what I’d call “flexible.” If you want to do something you have to do it the Bubble way. It’s possible that the way you’re thinking about your data needs to change to something Bubble can accommodate.

If you need a bunch of values, do they have to be stored in a list? Bubble doesn’t do very well with lists. Can you work out a storage system that just uses tables, rows, and fields?

@EduardIchim Actually I figured out how to Increment a Custom State. Seems rudimentary now that I figured it out, but couldn’t find documentation anywhere. Hopefully this can help someone else trying to increment something.

1 Like

Works the same on any field with a type of number be that input, database, custom state…

I’m interested in learning more about how you achieved your result. What are you incrementing here? A list or a value? I have a list of workers that I want to display individually in an input. I want to be able to click a button and have the next worker in the list display in the input. The other issue is that the list needs to cycle back around once the list reaches the last worker.

I was incrementing a custom state’s value.
Here you go, I think I created what you are looking for:
I put Person 1, Person 2, Person 3 in a DB with respective number ID’s 1,2,3. And then insert Dynamic Text on a text box (or input box) Do a search on that box for Person’s Name with a condition of the Person’s ID being = to the incrementing button’s custom state. Then in the workflow, you can make use of the “only when” conditions for the incrementing and also the starting over part. Just dig through my workflow and it will hopefully make sense.

@Blake, you are the man!