variables

Oct 09, 2012

Sent 4 days ago

Hi Mike,

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?

Thanks

Kathy

6 Replies
Matthew Graham

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:

  1. create variable for each field (it will do this automatically if you insert numeric data)
  2. create a variable for the total (let's call it varTotal)
  3. Add triggers that adjust varTotal
  4. Do this for all fields
  5. 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.

Jamie Morgan

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.

Jamie Morgan

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.

This discussion is closed. You can start a new discussion or contact Articulate Support.