## Forum Discussion

# Variable change when user upates an answer?

- 2 months ago
As you've discovered, you have to be very careful about when you perform math operations on a number variable.

There's a simple solution to your problem: reset the Total, and then add all of the variables every time the user edits one of the "How many..." fields.

And a simple way to do that: Every time one of those variables changes, show a "counting" layer. Don't put any objects on that layer. Just do the math, and close it.

This is shown in an edited version of your slide in the attached file.

FYI: Here's more info about using invisible layers: TIP: the Incredible Power of Invisible Layers | Articulate - Community

As you've discovered, you have to be very careful about when you perform math operations on a number variable.

There's a simple solution to your problem: reset the Total, and then add all of the variables every time the user edits one of the "How many..." fields.

And a simple way to do that: Every time one of those variables changes, show a "counting" layer. Don't put any objects on that layer. Just do the math, and close it.

This is shown in an edited version of your slide in the attached file.

FYI: Here's more info about using invisible layers: TIP: the Incredible Power of Invisible Layers | Articulate - Community

- JudyNollet2 months agoSuper Hero
And, yes, the counting could have used the Count1s value instead of bothering to put it into the 1stotal value. I just like using similar variable names for a given task. 😁

- JeanMarrapodi-c2 months agoCommunity Member
Fabulous. Thanks for the quick reply. I shall try this!