How do I calculate votes for a button press and display the number of votes gained by a contestant it in other screen

I have been using cloud db for my voting app

So when the user click the vote button the number of votes gained must be displayed in other screen

The votes must be displayed here with the leading contestant Below
Please help :pleading_face:

can you please show ur blocks? for both screens

How are you storing the total number of votes for each item in cloudDB ?

This SS Is for the button one

And this below ss is for the label one

Actually that's what I need Actually I'm saving
The contestant names in cloud db with the election name as tag

Doing what you are doing is open to error, because another user might make a vote while you are in the middle of the vote.

Probably better to append votes to a list in a tag, then total them up in the app when you want to see the totals. Unfortunately, cloudDB itself does not have an incrementing value (even though the underlying redis database does handle an increment.) You could use firebase instead ?

Actually this is just a prototype, And I was facing error while using firebase. So, Can you please provide the screen and block pictures for the idea you mentioned to save votes

Probably better to append votes to a list in a tag, then total them up in the app when you want to see the totals. For this one please :pray:

Have you written the code/blocks for only allowing one vote button to be clicked, allow user to change their mind, then eventually submit their vote? (More complicated if they can vote for more than one candidate!)

Do that, then when you have the vote for the candidate append a 1 to the list for the candidates cloudDB tag.

To get the total for a candidate, call back the list from their tag, and then add up all the 1s in the list (or just get length of list)

1 vote per user only. And can you please provide the block design :pray::pleading_face:

  1. How many user will use the app?
  2. You are the only one who going to use it for vote then first prefer to store the count in tinydb.
  3. Once vote completed, pass the count to anydb.
  4. At a same time if multiple users will use the app mean, sometime in a fraction of second there will be some problem may occur while increamenting the count.
  5. Do not prefer to store every vote in online (no issue with fb, even if you prefer), but just opinion from our side.
  6. If you want to store, then use four tag. Every time on button press give a beeb sound for 3 sec in that time duration you can send increment the concern party tag vote.

Less than 10 person may use this app

Can you provide a block picture or a tutorial it will be really helpful please

Then as said by taitun, firebase would be better. I didn't find any exact tutorial but they are simple logics only

When any button clicked. , Run notifier to play along with an clock to timer with interval of 3k or 2k. Meanwhile set beep to play. Call the particular button tag value

(Once fb get value, add +1 and immediately save the value in the same fb tag)

this will over within the clock to finish the timer

Once timer over,
Set the clicked button ro red, stop the music, and clock

That's all dear .

Ok I will try

Something like this

listTolabels.aia (5.7 KB)

Thank you so much buddy I will implement this in my app

Vote(1).aia (17.3 KB)

also check this too ( Firebase) - just add your fb url.. This will allow per user per click. Then reset to for next vote


Hey can you answer my other post

Error in calculating the length of the value in cloud db

Basically this is a voting app
And to calculate the results I'm using cloud db
Here is the tag and value pair in database

And the block view is

After the code runs it shows something like this

Please help me :pleading_face::pray: