Forum Discussion
Calculate Variables
Is it possible to set a value/variable equal to an equation of other values?
For example, L / R x P = Z
I currently have L, R, and P as individual number variables (the learner inputs a different number into each box). How can I set Z to calculate based on the equation above?
5 Replies
- RonPricePartner
Hey Samantha
There could be several ways of doing this. I put together a brief sample that might point you in a direction. (see attachment)
- MeiliJiCommunity Member
Hello Ron,
I refer to you sample. It's great. I have another question about the final total result. Do you know how to change the decimal places and display the result as a percentage?
eg. 0.002
As current setting, if the result is 0.002, only show 0. I want to show 0.2%.
Thanks
Meili
- SamanthaGera814Community Member
Thanks, Ron! This worked great. I was getting hung up on the last step of setting a trigger to adjust a separate ("total") variable. I appreciate your help!
- PhilMayorSuper Hero
The storyline will round to 2 decimal places; we have no control over that. You can do the calculation in JavaScript and send it back as a text variable, which will maintain the formatting
- MeiliJiCommunity Member
Thanks, Phil. But how to access to the JavaScript and I have updated the storyline to the newest version. Attached is my working story file for your reference.