Forum Discussion

SamanthaGera814's avatar
SamanthaGera814
Community Member
2 years ago

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

    • MeiliJi's avatar
      MeiliJi
      Community 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

  • 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!

  • 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

  • MeiliJi's avatar
    MeiliJi
    Community 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.