Calculating Pricing with Percentages?

Hi All,

I have been staring at this issue for too long. Need help!

I am wanting to do some calculations using percentages, as well as adding, subtracting & multiplying. For Example./
10 x 2         = 20             
20 x 5         = 100            Rate
100 - 30%  = 70              Discount
70 + 9         = 79              Fee
79 + 10%    = 86.90        GST

I have worked out the to use Numeric Entry and Triggers. But cannot not get it to work at the percentage onwards. HELP!

I have attached where I am up to. Ignore the basic layout, was working on functionality not presentation. Thanks in Advance :)

13 Replies
Jackson Hamner

You could probably use javascript to run more complex calculations. The eval(); function will evaluate whatever you need it to. Attached is a calculator built in storyline, I dont know if there is anyway to run it easier in storyline but this is how I would do it.

Here is some information on how to do percentages in javascript as well  http://stackoverflow.com/questions/4372902/javascript-calculate-x-of-a-number

Hope that helps!

Michael Hinze

You didn't list how the Page Loading % plays into the calculation, but with the values you provided, see attached a Non-Javascript option. It requires some additional variables to hold temporary values and some math, but (unless I misunderstood something) it does calculate the values.

 

Michael Hinze
Jackson Hamner

Oh wow, Nice! I actually didnt know base articulate could do that sort of math!

 

Heck yeah :D

Using JS certainly simplifies things when it comes to more complex math, but lots of people are not familiar with JS. So, using a bunch of Storyline triggers is often a workable alternative.

Jessica Hunter

Thank you!!! :)

Jackson - I have not used JS before, would love to know more about it. Might make that my Q1 self learning goal. I have seen a lot of discussions around using them.

Michael - That is fantastic!! Did not expect for you to do all the hard work for me. Thank you! I see the Discount Temp & GST Temp Variables. Which has solved my issue. I did not know we could have variables not linked to an object.

I am loving how much more Storyline can do and how great the Elearning Hero Discussion boards are.

Jessica Hunter

No matter how many different ways I try to put that slide into my storyline module it doesn't work.

- Cut and paste whole slide

- Cut and paste objects only

- Import slide

Every time it doesn't calculate properly. I check the formulas and nothing is broken. I then tried to open a new storyline and see if I could place it in there but wouldn't work.

Any suggestions?

Jessica Hunter

Hi Ashley,

Thank you for you reply. I had another look at it and for some reason every time I put the slide into my existing course it would paste and copy the variables. I went through and deleted the extra ones and it worked straight away.

Also, Would you know of a way to get them to round to the nearest decimal?