Forum Discussion
Basic Calculations with variables troubleshooting. Assistance requested :)
A variable is used to store a value (for example: True or False; a text entry; or a numeric entry). The program "remembers" the value throughout the course. It won't change until a trigger runs that adjusts the value.
When you insert a data-entry field, Storyline (SL) automatically creates a variable to hold its value.
- SL gives the variables generic names. It will be quite helpful for your programming and for troubleshooting if you take the time to give all variables (as well as all objects) meaningful names.
Numeric-entry fields have numeric variables, which means the variable will only accept a number. That also means the program can perform calculations using the value.
In your case, you want the PV, EV and AC variables to maintain whatever value the user inputs. In other words, you don't want to perform calculations on those variables. Instead, you want to perform calculations with those variables.
Here's an example. The Variable Schedule = Earned Value - Planned Value. You need multiple triggers to do this. The first trigger sets the starting value. The subsequent trigger performs the calculations. They would look like this:
As you can see, you'll need a set of triggers to perform each of the 4 calculations you want to show.
The four calculated values/variables won't change until the calculation triggers run again (i.e., the user re-clicks the Calculate button).
The Clear button would need triggers to set the value of all of the variables to 0.
There are various ways to prevent the user from making changes. For example, cover the entry fields with a semi-transparent shape and disable the Calculate button when the user clicks the Calculate button. Then hide those shapes and enable the button when the user clicks Clear.
For troubleshooting:
- As I said, giving everything a meaningful name will help.
- Be sure each trigger refers to the appropriate variable(s).
- Be sure the triggers are in the proper order. (They run in order.)
Here's more info about variables: https://community.articulate.com/series/articulate-storyline-360/articles/articulate-storyline-360-user-guide-how-to-work-with-variables