Variables in Table Calculator - help!

*Fixed, see comment below! 

Hey everyone,

I've created a calculator that allows someone to keep track of positive and negative events that happen throughout their day for an emotional intelligence course.

I've attached the storyline file and a video of what's going wrong.

There are four columns - the event column is where the user types the event that happened. The withdrawal column is where the user would put a dollar amount if it was a negative event, and the deposit column is where they would put a dollar amount if it was a positive event. When the user hits the calculate button, that row's balance will update based on where they put their dollar amount (it will be a negative number if the number was in the withdrawal column, a positive number if the number was in the deposit column). Each row's individual balance will also add to the total balance at the bottom. All of this was built with numeric text entry fields and variables.

The problem, as you can see in the video, is that each row's balance adds to itself whenever you hit the calculate button after completing a new row instead of staying static once it's been calculated. 

Please let me know if you have any tips, thanks! 

3 Replies
Maria Costa-Stienstra

Hi, Anna!

Thank you for sharing your .story file and the video recording showing what is happening.

I added a few triggers to your calculate button, and those seemed to do the trick! Those new triggers set the calculations for the total balance and each row back to their initial values (100 for the total balance and 0 for each row). 

Windows 10 (1) 2021-03-03 at 12.03.43 PM

Since those were added to the top of the trigger list inside the calculate button, they are the first ones executed when you click calculate. Check out this article for additional information on rearranging triggers.

I am attaching your edited .story file. Let me know if that works!