Forum Discussion
Math operations on 2 numeric fields
Hi there. I'm curious if it's possible to perform a math operation based on the following scenario:
var3=var1+(var2/2)
How would those triggers look...? Thanks in advance...
- JudyNolletSuper Hero
Storyline doesn't allow full equations in a trigger. You have to do each part separately.
- Set var3 to var 1
- Divide var2 by 2
- Add var2 to var3
FYI: The default action when adjusting a number variable is Set. Just click that to access the math operators.
- CaryGlenn1Super Hero
- NedimCommunity Member
I can confirm that both Jud's and Cary's solutions would work in Storyline. Alternatively, you could use JavaScript to calculate the result. The advantage is that you can easily replace operators in different scenarios without needing to adjust the triggers yourself. See the attached video for a demonstration.
- WilliamRyan-dbaCommunity Member
Hi All, thanks for your suggestions. I'll give them a try. I am hesitant to try Javascript for 2 reasons: 1) I don't know how to program using Javascript and 2) the number formatting is lost, and the value is returned as text. At least that's my understanding...