Resetting a variable each time it changes
Apr 14, 2015
I'm creating a tool for sales agents to calculate a customer's cell phone rate plan (minutes, texts, data, etc.) while they're on the phone with them. The idea is that agents can see the total cost adjusted as they adjust each field.
I made layers with a dropdown box for each field (minutes, texts, data, etc.) Each layer includes a subtotal variable for that field. The variable is set to zero each time the user goes back to the layer to choose another option. Then the price for that option is added to the variable.
I'm having trouble showing the grand total on the main slide. I set up the grand total variable to add each field subtotal variable. The problem is I can only figure out how to add the subtotals together, but if the user goes back to change an option, that new price is ADDED to the previous amount of the grand total. It doesn't reset the grand total. The number just keeps getting bigger and bigger instead of only reflecting all the new subtotals.
I want my tool to work like this example - http://dev.keypointlearn.com/xcl71_SL/Refresh/story.html, where the total amount (in green) adjusts automatically to reflect each new adjustment. Is this only possible with the slider?
4 Replies
I built this example. You could simply add a Reset button, with triggers that Assign a value, e.g. 0 to each of the variables.
Thanks, Michael. Your example is excellent.
I was hoping to find a solution that automatically adjusts the total every time one of the fields (subtotal variables changes).
So far, I'm setting a separate trigger to set the Grand Total variable to 0 whenever subtotal 1 changes, another for whenever subtotal 2 changes, etc. Then I have to add a separate trigger to add subtotal 1 to the grand total variable whenever subtotal variable 1 changes, whenever subtotal 2 changes, etc. And more separate triggers to add subtotal variable 2 to the grand total whenever subtotal 1 changes, subtotal 2 changes, etc. And so and and so forth. I have 6-7 different fields, so that's 6-7 triggers for each variable. This is very tedious.
I wish there were a trigger like the one that adjusts a variable whenever the slider moves, but for non-slider interactions.
Yes, it often requires quite a few triggers to reset variables and recalculate total values. Also, pay attention to the order of your triggers. Triggers are executed from top to bottom. If you are still stuck, you can always share your .story file here, so that we can have a closer look.
Thanks, Michael. Once it's ok for me to share the information with the public, I will share the file if I still can't figure it out. I really appreciate you help!
This discussion is closed. You can start a new discussion or contact Articulate Support.