Forum Discussion

ValerieHuddl276's avatar
ValerieHuddl276
Community Member
17 days ago

Multiply 4 numeric values

I'm trying to create a business potential calculator in Storyline 360 that multiplies 4 numerical values (NV for below) to result in a dollar amount. Below is what I'm trying to accomplish.

NV1 x NV2 x NV3 x NV4 = NV $Amount

 

I'm having trouble coming up with variables and triggers for the Calculate button as I can only multiply one variable with just one other variable rather than multiple variable. I've seen some tutorials on adding up numbers behind the scenes or calculating with only 2 variables, but I'm unable to find something that can multiply 4 numbers together to get a result.  

I'm creating this in a table so each NV has a descriptor on the slide. 

I'm at beginner level with using variables, so any way to make this easy to understand would be fantastic. 

Much appreciated!

  • It's true that you can only perform one math calculation per trigger. That means you'll need multiple triggers to multiply 4 numbers. 

    For example.

    • Use NV1, NV2, NV3, and NV4 as the variable names for the 4 values to be multiplied.
    • Also create a numeric variable (e.g., NV_calc) for the calculated amount. 
    • Trigger 1: Set NV_calc to the value of NV1
    • Trigger 2: Multiple NV_calc by the value of NV2
    • Trigger 3: Multiple NV_calc by the value of NV3
    • Trigger 4: Multiple NV_calc by the value of NV4

     

    The NV_calc variable will update with each trigger.

    Note: Access the operators by clicking that part of the trigger wizard.

     

  • It's true that you can only perform one math calculation per trigger. That means you'll need multiple triggers to multiply 4 numbers. 

    For example.

    • Use NV1, NV2, NV3, and NV4 as the variable names for the 4 values to be multiplied.
    • Also create a numeric variable (e.g., NV_calc) for the calculated amount. 
    • Trigger 1: Set NV_calc to the value of NV1
    • Trigger 2: Multiple NV_calc by the value of NV2
    • Trigger 3: Multiple NV_calc by the value of NV3
    • Trigger 4: Multiple NV_calc by the value of NV4

     

    The NV_calc variable will update with each trigger.

    Note: Access the operators by clicking that part of the trigger wizard.

     

  • Thank you so much, Judy. This was very helpful! I didn't realize that the NV_calc could store all the entries, and that's what I was having the biggest trouble with. 

    Happy sidenote, I like that it doesn't recalculate if I click the Calculate button again. I have to re-enter values in each field re-activate the Calculate button, which is exactly what I needed. (Adding in case someone else ends up in the same place as me.)

    I watched some tutorials and my head started to spin when I saw directions for Javascript 😵 Would love to get there eventually! This was a simple and effective solution, and your help is very much appreciated. 

    • JudyNollet's avatar
      JudyNollet
      Super Hero

      I'm glad you've got your slide working they way you want it to.

      For future reference (for you or anyone else who finds this thread): Here are some  common mistakes:

      • Not properly resetting a variable. (For example, using only triggers that perform a math operation, but without starting with a trigger that sets the "total" variable to the appropriate starting number.)
      • Not controlling when/how often the math operation is performed. (For example I've seen files where the total variable becomes higher than expected because the user re-clicks a button and a number is added every time they do that.) 

       

      Bottom line: It's good to show the variable references on the slide. That let's you watch what happens as you interact with the slide, which helps with troubleshooting. If the user doesn't need to see the references, just move the text box with the references off the slide, hide it, or delete it before publishing. 

      Best wishes for success with your projects!