Having trouble making a calorie counter with global variables

I am new to Axure RP, I am using RP 7. I am creating a weight cutting application. The features in my app are counting the calories you burned and you have eaten. I am having trouble with global variables. Local variables are working fine for me. The you can still eat number is 2500 because that’s the standard amount of calories a person can consume within a day. When the user exercises this increases and when the user eats it decreases. I set a global variables called YouCanStillEat=2500 YouHaveBurned=0 and YouHaveEaten=0. I have set up a function on click “whatever” exercise "set text to [[YouHaveBurned+400]]. The text then turns to 400. Now the problem… When I click this exercise again “just say if I ran twice and burned 800 calories”, the text wont change to 800 it only shows 400. It only shows [[YouHaveBurned+400]] it wont shows [[YouHaveBurned+400+the value of the next exercises or this exercise repeated, if anyone could help it would be much appreciated thanks!

This might also help ye figure out where I am stuck!

That’s because you’re just setting text using the variable and not actually changing the value of the variable.

Before your set text action, add a Set Variable action. Set the YouHaveBurned variable to [[YouHaveBurned + 400]]. This sets it to whatever it was before (0 the first time) plus 400 more.

Then you can just use [[YouHaveBurned]] when you set text because you already added the 400.

Ah yes I see thanks! I’m still not quite there when I click my button running my prototype a button with 2 cases pops up, I just wanted to click the button and change the value with one click and not have two separate operations I have attached more screenshots

Not to worry I think I fixed it this is my solution. I had two separate cases instead of all the one case! Thanks very much for your help!