Click on Button

How do i increase a integer field in my database when i click on a button?

I suspect you can simply do this:

  1. Update a Thing
  2. Set Field Value = original value +1

You can input the original value by doing a search for that table and field.

Alternatively, you could store the database value as a custom state on the page. Then, whenever a user clicks a button you set the value of the custom state +1 and then update database to be equal to the custom state value. This seems a bit more clunky though.

1 Like

Thanks, I can find the “Change a Thing”, but I cant fix the second part "Set Field Value = original value +1.

If your Thing is a Poll, and you have a number field called Votes, you would “Make a Change to Poll” - Define which poll by either searching you database or referencing a Poll that is on the page (depends on how you have things set up on the page).

Change field --> Votes = This Poll’s Votes + 1

Feel free to share a link and we can take a look.


Gaby | Coaching Bubble

Okay I want to make an app where people can vote on Trump or Clinton. After the vote of the user you will see the voting stutus. Can you help me with it?

Of course! Could you share a link to what you have so far?

https://bubble.io/page?id=worldvote

Ok a few things are happening here. We can achieve this with how you’ve set up your President data (take a look), but I would have actually structured it like this:

President

  • Name
  • Votes

So that you can have 2 President entries, 1 for Clinton and 1 for Trump.

The way you have it now is that you’re recording votes for both presidents within 1 data entry. It works, but probably not the cleanest if you want to have more data for each president. Anyway, you didn’t have any President entries created in your database, so I added a New Entry (Data Tab > App Data > New Entry).

On Trump’s button, we’re making a change to that entry I created. To find it, I “Searched for Presidents:first item” (we only have 1 President entry, but a Search returns a list, so we need to single down). Then the field to change is Trump. Trump = This President (still referring to the single entry)'s Trump + 1. I did the same for Clinton but the field to change is Clinton.

Also, in your text box on the page, I added the dynamic text to display these field values. Take a look at all of these areas and let me know if that makes sense.


Gaby | Coaching Bubble

Yeah thank you! I does make sense. Really good service!

Do you also know how to launch an app on google play and app store?

I just went onto your app link and the art looks pretty neat. Where’d you get it done?

Thanks ! I picked the background images from google . I filltered the images by transparent.