How do I implement this kind of function?

Does OutSystems11 have a function to record how many times the user clicked  "Correct" button and "Wrong" button in total
I'm not sure if  you can implement  this kind of function to calculate the probability of how many times  "Wrong" button was clicked out of the total number of the two buttons clicked.

By doing that, I hope to display the probability on top right on the screen.

How do I  implement this function?


Hi Tsubasa Yoshikawa,

What is your goal with this "exercise"? It doesn't seem to be real-world.

I'd just create two local variables: CorrectCount and WrongCount (both initialised to zero). Every time a user presses the Correct button I'd increase the CorrectCount variable by one, every time a user presses the Wrong button I'd increment the WrongCount by one.

Probability, with just two choices like here, is always 50% (like a random coin toss). Having the percentage of times Wrong was pressed would be as simple as having an expression with WrongCount / (CorrectCount + WrongCount).

This will only work as long as the user remains on the same screen. If you want an overall count, regardless of how many users are using your application, you'd need to store those two values in an Entity.

Hope this helps...