I am trying to bulid a page where I can have numeric data entered into about 15 fields and then total them. Do I use variables for that or just the numeric data fields, and how do I get them to add up for a total?
When you use the insert>numeric data, it will actually create and assign variables for you, so you'll be using variables either way.
So:
create variable for each field (it will do this automatically if you insert numeric data)
create a variable for the total (let's call it varTotal)
Add triggers that adjust varTotal
Do this for all fields
use %varTotal% to display total
I would love it if there was a trigger that could do mulitple calculations, but I don't believe this is the case. I'd certainly like to hear an easier way of doing this, but I'm not aware of one.
You'll need to build in some additional functionality to account for the possibility of someone going back and changing numbers after they enter them the first time.
Personally, I'd put a "Calculate" button on the screen and have all the triggers on that button. This means no calculation would be performed until they clicked on "Calculate". That could also trigger the displaying of the result along with a "Clear" button to clear the "varTotal" variable or whatever variable you use for the calculation. If you don't clear it and someone goes back and changes a number and hits calculate again, it will simply add all the numeric values to the prior total - thus creating a running total result.
Good point, Jamie. You could also set the slide to clear all variables upon return if you need to avoid extra buttons.
I highly recommendreading theVariable Tutorial, as there aregenerally different ways to do things,and you'll want to do what's right for your specific project.
That's one option Matthew. There definitely are many ways to do things - that's for sure. =-) The "on timeline start" clearing of the variable would work assuming that you were leaving the layer to display the total. You wouldn't necessarily need to leave the layer depending on how or what functionality you were looking for.
I dont think you need to clear the variable values, if the first trigger asigns the vaule of variable 1 to the total variable instead of adding and then adds subsequent variables. This way you never get the problem of if the user presses twice
6 Replies
MIke
Posted to the link. I was out for a few days.
Thanks
Kathy
When you use the insert>numeric data, it will actually create and assign variables for you, so you'll be using variables either way.
So:
I would love it if there was a trigger that could do mulitple calculations, but I don't believe this is the case. I'd certainly like to hear an easier way of doing this, but I'm not aware of one.
You'll need to build in some additional functionality to account for the possibility of someone going back and changing numbers after they enter them the first time.
Personally, I'd put a "Calculate" button on the screen and have all the triggers on that button. This means no calculation would be performed until they clicked on "Calculate". That could also trigger the displaying of the result along with a "Clear" button to clear the "varTotal" variable or whatever variable you use for the calculation. If you don't clear it and someone goes back and changes a number and hits calculate again, it will simply add all the numeric values to the prior total - thus creating a running total result.
Hope that makes sense.
Good point, Jamie. You could also set the slide to clear all variables upon return if you need to avoid extra buttons.
I highly recommendreading theVariable Tutorial, as there aregenerally different ways to do things,and you'll want to do what's right for your specific project.
That's one option Matthew. There definitely are many ways to do things - that's for sure. =-) The "on timeline start" clearing of the variable would work assuming that you were leaving the layer to display the total. You wouldn't necessarily need to leave the layer depending on how or what functionality you were looking for.
I dont think you need to clear the variable values, if the first trigger asigns the vaule of variable 1 to the total variable instead of adding and then adds subsequent variables. This way you never get the problem of if the user presses twice
This discussion is closed. You can start a new discussion or contact Articulate Support.