Variable Tutorial with Calculations
I was watching a tutorial by Jeanette titled Adding Data Entry Fields. The tutorial did a great job of showing how to enter text fields. The example she used also showed how it is possible to have some numberical entries for the user and at the end it would calculate a result.
The example was about a 401(K) plan and how the employee could enter a dollar amount, number of years and a percentage to get a result. Is there a tutorial that covers a similar type of calculation?
I did look at the tutorial for Adding Number Variables but it only demonstrated how to assign a numerical value for a choice. It did not show how to do a calculation.
Thanks for the tutorials and I hope there is one for calculations or that you can make one.
Jeffrey Riley
16 Replies
Hi Jeffrey! I did a quick screenr on how the calculation slide was built, but maybe it would help to also take a peek at the slide itself so you can deconstruct:
Screenr
Published demo
Source file
The slide asks the learner to enter 3 items: their salary, the percent they plan to contribute to their 401k, and the number of years till retirement. When they click the Calculate button, a layer appears which shows them the total amount of matching funds the company will contribute on their behalf.
Here's the logic behind the calculations:
I also have a different layer which pops up if the learner tries to hit the Calculate button without entering all the required information.
I hope that helps!
That was just what I wanted. I will know I have this down when I can make my own examples by stepping through the logic.
Thanks to all of you who do the tutorials, GREAT JOB!
Thanks for asking the question Jeffrey and thanks for the example Jeanette.
I built a similar tool and I have it working fine. The user enters 3 numbers and they perform the calculation. Is there a way to reset the fields so that they can try again with different numbers? Ideally I'd like them to click a Reset(!) button so it clears the values and they can play with as many numbers as they want.
Add a reset button that sets all the variables to 0
Hi David! Phil's idea is a good one - if your interaction is like the the 401k example posted above, you could perhaps add some triggers to the "Thanks" button on the layer called Results. That way, learners could close the layer and reset the values all with one click. Here's how the triggers would look:
Thanks Phil and Jeanette! Works like a charm.
Can we revisit this for a bit please? I'm building a calculation much like this and it's working. But is there a way to format the numbers, i.e. 4,000 instead of 4000?
Hi Carrie! I saw this discussed in a previous thread and I think that this is what you are looking for.
Hi, All. I have a variation on this thread. I have the learner enter a single-digit number in a numeric data entry box on seven different slides. On the final slide, I want those seven numbers to total into the last box. Can you help me with that, please?
Thanks - Melissa
Hi Melissa, have a look at the attached sample and see if that's what you want. The final slide has a bunch of triggers that add the values of the seven data entries from previous slides into one total variable.
Hi Melissa,
It looks like Michael has helped you out, and if you need anything else please let us know.
Genius, Michael! Thanks so much. Melissa
Hello, I am working with a numeric entry and need three decimal places. When I am creating a condition for a trigger it will automatically round the decimal to two places. How can I change this to three decimal places with not rounding?
Hi Brent,
This thread is a bit older, so I'm not certain if folks are still subscribed so you may want to message them directly using the "contact me" button on their profile to see if they're able to share what they ended up doing. You may want to also look at investigating what options you have if you were to use Javascript to work with multiple decimal points in variables. It may be something the community can assist with, but you may want to begin by reviewing the best practices here.
can i get result total in php ya javascript variable.
Hi Rakesh,
I just responded to your question here, and this conversation may shed a little more light on what you want to do.
Tracking in a text file or database is not something I can assist in supporting. As I mentioned in the other conversation, we recommend publishing to an LMS.
Hopefully, someone in the community will be able to chime in and help you out here.