How to perform dynamic arithmetic

I have a database that has a player in every row, and each column has a different header such as “forehand good” and “forehand bad”. Users will come to the website, search a player’s name, and press a button that adds to the total of “forehand good” or “forehand bad” for that player’s datapoints. I then want to display what the entire community of users thinks. Example: 30 people marked the player as “forehand good” and 70 people marked the player as “forehand bad”

On the next page where I display the data, I want to perform the mathematical operation that displays a percentage:

Forehand Good / (Forehand Good + Forehand Bad) * 100%
30 / (30 + 70) * 100% = 30%

On the website it would display:
“Forehand Good:” 30%

Due to Bubble’s limitation and not using PEMDAS, and instead reads left-to-right, I am unable to display the data properly. So, I added the math.js plugin and the Instant Calculator because these are supposed to use PEMDAS. well, I enter in the same formula as above, and neither of them are visible when I load the page and when I search the player and the data is extracted in order to perform the operation. As a matter of fact, even when I type in 1+1 for both of these, it is still not visible. I have no clue what to do. I have marked them both as being visible upon the page loading, and I have created a condition that makes them visible when another text box (which is visible after the person searches for a player and clicks on that player) becomes visible. And yet neither of them ever become visible. I used Inspect on the Preview page and both of them say “this element is visible yes” under the Condition, but under Properties, it says “this element is visible no.”
I have not been able to figure it out for the last 2 hours and it is getting frustrating as I feel it should be really easy to use these tools.

All I did to sign up for these plugins was go to the plugin tab, search them, and press “add plugin” so I don’t have an API for them but I don’t believe I need one to use them.

Any help is much appreciated!

I don’t believe you need a plug in to solve the problem. I think you can store the interim calculations in your data type for each player and then use Bubble’s left-to-right as needed to render the results you need.

Would you know how I can add the interim calculation to my dataset?

I used that workaround. I think it will work better in the long-run anyway as a deeper way to look into the data. Thank you!

1 Like