Calculating Pricing with Percentages?
Feb 10, 2015
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
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!
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.
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.
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: if you do want to learn the basics of Javascript, have a look at: http://www.w3schools.com/js/default.asp .For some examples that shows how to use JS with Storyline, see here: http://articulate.com/support/storyline/javascript-best-practices-and-examples
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?
Hi Jessica,
I just tried importing it into a new file -and everything seemed to work fine on my end. Did you check that elements such as Variable names didn't match anything else already in your project that could be interfering?
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?
Here is one Non-Javascript option to round numbers in Storyline: https://community.articulate.com/discussions/building-better-courses/a-solution-to-rounding-in-storyline-without-using-javascript
Hi Jessica,
It looks like Michael has you covered here with the rounding of numbers, as there isn't a feature or method of rounding the variable results.
Excellent - This has worked a treat. I rounded it to 100,000 and that worked.
I am very happy with the support of elearn heroes we have on here. THANK YOU!
Glad you got the help you needed here
This discussion is closed. You can start a new discussion or contact Articulate Support.