add variables

aoswald Community Member Posts: 126 ♪ Opening Act ♪
Is it possible to use a formula in the value field of "Set Equal To" type of "Modify Variable". For example VAR(1) + VAR(2) + Var(3)

The Add to Variable type will not work in the scenario i want.

I'm using Lectora v 11.3



  • dfleary
    dfleary Community Member Posts: 81 ☆ Roadie ☆
    There is not a way to do that as you suggest, however Add to Variable should work. Create a variable called "Total" or something like that. Then have actions to:

    Mod Var Total, Set Equal To, Var1

    Mod Var Total, Add To Var, Var2

    Mod Var Total, Add To Var, Var 3

    The result is that Total=Var1 after the first action. Total=Var1+Var2 after the second action. And Total=Var1+Var2+Var3 after the third action. Then use Total as the condition variable for whatever you need to do next.

    Daryl Fleary

    Product Manager
  • aoswald
    aoswald Community Member Posts: 126 ♪ Opening Act ♪
    there is a possibility that any of the variables can change. If I keep using add to variable, the total will just keep getting bigger. I need to "set" the variable by adding all of the parts together.
  • timk
    timk Community Member Posts: 1,237 ✭ Legend ✭
    You can set your "Total" variable to "0" as a first action before adding the three variables. Run the whole calculation each time one of the variables is changed.