I am stuck while adding the dollars with two decimal values .The values are not rounded to 2 decimal places and the addition is result just appending the values.It adds the values as strings.
Please note.If there are no decimal values the addition function works fine.
That’s strange. That does seem like a possible bug.
Can you post a link to your project?
Also, whenever you use a stored variable, you need to give it a value if it is null. Please try adding a When screen is opened block and inside it, if stored variable add = null then set stored variable to 0.
Hello, i have also faced this similar problem few months ago, when i was making a calculator app, my code was very similar to you.
I suggest you to use set stored variable add instead of change variable add block to add 2.50, i think is a bug, when we try to set a variable to a specific decimal place, it automatically ignores the last zeroes
And one more suggestion, when you use this block: set variable add to add + 2.50, it will change your variable and text to 2 decimal places but, then also have to use +1.001 (or any number that can be rounded of to 1.00 like 1.000003, 1.000342) with 2 decimal places, because if you click button b, it will change 5.00 to 6, instead of 6.00
So, i think you got your answer, Try this code https://x.thunkable.com/projectPage/649400d012e8d2ad638752b7
And this issue you say is a javascript bug, the thunkable compiler instead of adding 2.50, it first auto round off 2.50 to 2.5 and then concatenate it with previous sum, see as you click it only adds 2 and 5 to the text and the text becomes longer and longer
I need some help with my canteen app, I can’t show the total on screen two and i don’t know how to integrate the decimal solution. I’ll insert the link to my project, please have a look. Will help me greatly. thank you.
Thank you so much, but i’ve got a new problem. In screen two when you add the items, and when you minus with a random minus button it subtracts the total.
@baladitya.harshavard please explain the issue and send link of new app,
What do you mean by : random minus button and subtracts the total
But the issue i understand, is that you trying to say that if you click on minus btn of any item with 0 items taken, it does not make the item -1 but still cut the price,
And from the screenshot, you are trying to say that you 2 burgers of 10$, but the total is 0$, when you click on minus btn of cola 4 times.
If this is your issue, then the solution is, you have to use conditions, when user click on minus btn, if count is 0, then show a text or alert message intead of calling the sum function and rewriting the total.
If this is not the issue, then please elaborate the problem in more detail and send link.