# Script variable question

**URL:** https://www.finalbuilder.com/forums/t/script-variable-question/2310
**Category:** Discussion
**Created:** [September 28, 2014, 11:22am UTC](https://www.finalbuilder.com/forums/t/script-variable-question/2310 "2014-09-28T11:22:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![darian](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/darian/32/2195_2.png) [@darian](https://www.finalbuilder.com/forums/u/darian)
#### Post date: [September 28, 2014, 11:22am UTC](https://www.finalbuilder.com/forums/t/script-variable-question/2310/1 "2014-09-28T11:22:33Z")

</div>

Sorry, rather new to FB…  
  
I have multiple DUnit projects to be built, and each has their passed/failed count stored into variables.&nbsp; I’ve logged the variables and I know that’s working.  
  
I tried a simple script to add the two together into another total variable but I’m apparently missing something super obvious.&nbsp; Do you have examples of simple project variable math?&nbsp; I see increment/decrement action but I’d like to add variables together…  
  
I’ve added a Run Script action with the basic. OnExecute  
FBVariables.TOTAL\_FAIL = FBVariables.TOTAL\_FAIL + FBVariables.TESTRUN\_FAIL  
  
Or a little more explicit  
dim x,y  
x = CInt(FBVariables.TOTAL\_FAIL)  
y = CInt(FBVariables.TESTRUN\_FAIL)  
x = x + y  
FBVariables.TOTAL\_FAIL= x  
  
With the basic type of the variables set to Variant or Integer I still don’t get the total value.  
  
  
Thanks

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [September 29, 2014, 12:11pm UTC](https://www.finalbuilder.com/forums/t/script-variable-question/2310/2 "2014-09-29T12:11:32Z")

</div>

Hi Darian   
  
 I just tried that here and it worked first time. Use the Watches tab to see what the variable values have during the script and then step through it.   
 There is also a Simple Math action which can do the job for you if you don’t want to use script.   
  
 If you send your project file to [support@finalbuilder.com](mailto:support@finalbuilder.com) we’ll take a look and see if we can figure out what is happening.

---

<div class="post-metadata">

### Author: ![darian](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/darian/32/2195_2.png) [@darian](https://www.finalbuilder.com/forums/u/darian)
#### Post date: [September 29, 2014, 12:28pm UTC](https://www.finalbuilder.com/forums/t/script-variable-question/2310/3 "2014-09-29T12:28:34Z")

</div>

Thanks… “simple math” action type! Wow, can’t believe I didn’t see that one. That works great.
