Forum Academy Marketplace Showcase Pricing Features

Counting without storing in database

Hi, bubblers! I need to count the number of times when the user pressed a button without storing the data in the database. It is clear how to do that using the "counter " operator, but it works only with the database.

Let’s say, I have a quiz app and need to count the number of right answers without storing it in the database.

In other words, are there any options to count some events on the page without storing things in the database?

Thanks in advance!

Custom states are your friends :slight_smile:

2 Likes

I get the idea. But still can not understand how to use it for counting. I guess there is a simple solution.

Just use a ‘Number’ custom state, and add 1 to the value each time the desired action is taken.

To do that you need to refer to the custom state’s current value first, then add 1.

i.e. custom state's value: + 1

1 Like

Create a custom state and call it “Right Answers”. Give it a default value of 0.
On a button click (only when the answer was correct) change the custom state to: “right answers value” +1

1 Like

Thank you, guys! You helped me a lot. It really works! :fire:
Custom states are my friends forever! :wink:

2 Likes