I refer to this as "Set & Pass." To help think through your logic, remember that variable can only hold one value at a time. In order to get one variable's value into another we first have to set it and then pass it (add) to another variable.
Wendy's solution demonstrates that concept exactly.
SET: Adjust Variable [1A] equal to the typed value when the control loses focus
PASS: Adjust Variable [TotCol1] +Add (the value of) [1A] when the control loses focus
Rinse & Repeat the above two triggers for each Data Entry field in each column
In Wendy's example the Total variable will keep adding values as the user enters a value in each of the Data Entry fields.
If you want the learner's to first enter values in all the fields and then click a button to add them all at once to the Total value, it would look like this:
SET: Adjust Variable [1A] equal to the typed value when the control loses focus
Rinse & Repeat the above trigger for each Data Entry field in column 1
Add a button for column 1 and add the below trigger to that button
PASS: Adjust Variable [TotalCol1] +Add (the value of) [1A] when the user clicks [button]
Rinse & Repeat the above trigger for each variable in column 1 and add to the button
This is great. I added a trigger to the button and moved it to the top of the trigger list which resets the TotCol1 or TotCol2 to 0 before adding the numbers together. This way you would only have a total for what is showing in the fields and not everything that has been entered if you made changes.
I'm having trouble figuring out what Nathan accomplished above. If I decide to change the value and total the columns it includes previous values. How can I make it that the button only totals the numbers showing in the fields, as Nathan mentioned above?
Nevermind I think I figured it out. I set a trigger at the beginning of the list that multiplies the total column by zero before anything is added. Hope that is helpful.
12 Replies
Hi Karel
without seeing your setup here is one way of doing it.
HI Karel,
What Wendy said ^
I refer to this as "Set & Pass." To help think through your logic, remember that variable can only hold one value at a time. In order to get one variable's value into another we first have to set it and then pass it (add) to another variable.
Wendy's solution demonstrates that concept exactly.
In Wendy's example the Total variable will keep adding values as the user enters a value in each of the Data Entry fields.
If you want the learner's to first enter values in all the fields and then click a button to add them all at once to the Total value, it would look like this:
That should do it!
Good addendum Kevin - wasn't sure if the user would be clicking to total or Karel wanted auto sum
Wow!!!
This community is so awesome. I'll try it and get back with you all. Thanks again.
SUCCESS!!! This community is so AWESOME! Thanks everyone for your guidance.
Yay! Glad it's working for you Karel!
"Set & Pass" - love it.
Thanks Kevin and Wendy for sharing!
This is great. I added a trigger to the button and moved it to the top of the trigger list which resets the TotCol1 or TotCol2 to 0 before adding the numbers together. This way you would only have a total for what is showing in the fields and not everything that has been entered if you made changes.
I'm having trouble figuring out what Nathan accomplished above. If I decide to change the value and total the columns it includes previous values. How can I make it that the button only totals the numbers showing in the fields, as Nathan mentioned above?
Nevermind I think I figured it out. I set a trigger at the beginning of the list that multiplies the total column by zero before anything is added. Hope that is helpful.
Thanks for letting us know how you solved it, Gregory! 😁
I would set the first trigger to ASSIGN a value of 0 to variable xyz.
This discussion is closed. You can start a new discussion or contact Articulate Support.