# How to use variable within a variable

**URL:** https://www.finalbuilder.com/forums/t/how-to-use-variable-within-a-variable/1267
**Category:** Discussion
**Created:** [July 21, 2009, 6:52am UTC](https://www.finalbuilder.com/forums/t/how-to-use-variable-within-a-variable/1267 "2009-07-21T06:52:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mozenda](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/mozenda/32/92_2.png) [@mozenda](https://www.finalbuilder.com/forums/u/mozenda)
#### Post date: [July 21, 2009, 6:52am UTC](https://www.finalbuilder.com/forums/t/how-to-use-variable-within-a-variable/1267/1 "2009-07-21T06:52:00Z")

</div>

&nbsp;I&nbsp;have a List Iterator action that is iterating over a set of values. Let's pretend these values are A, B, and C, and that they are assigned to a variable named %ListItem%.

I&nbsp;would like to have variables named&nbsp;DoWorkA, DoWorkB, and DoWorkC for each of A, B, and C, and then check their values (True or False)&nbsp;within the List Iterator to see if some type of work should be done. So:

List Iterator - A, B, C  
If %DoWork%ListItem%% = True  
&nbsp;&nbsp; ... do some work  
Else  
&nbsp;&nbsp; ... do something else

How can I&nbsp;accomplish this? The software does not let me do a variable inside of a variable. Is there an alternative method I&nbsp;could use to accomplish the same thing?

Thanks.

-Corey  
&nbsp;

---

<div class="post-metadata">

### Author: ![mozenda](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/mozenda/32/92_2.png) [@mozenda](https://www.finalbuilder.com/forums/u/mozenda)
#### Post date: [July 21, 2009, 7:28am UTC](https://www.finalbuilder.com/forums/t/how-to-use-variable-within-a-variable/1267/2 "2009-07-21T07:28:02Z")

</div>

Never mind. I found this helpful thread:   
  
 [https://www.finalbuilder.com/forums.aspx?aff=1&aft=4354&afv=topic](https://www.finalbuilder.com/forums.aspx?aff=1&aft=4354&afv=topic)   
  
 Basically, the thread (and sample provided in the thread) show how to use JScript to set the name of the variable in an action prior to the action being executed. This should work.   
  
 -Corey

---

<div class="post-metadata">

### Author: ![mozenda](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/mozenda/32/92_2.png) [@mozenda](https://www.finalbuilder.com/forums/u/mozenda)
#### Post date: [July 21, 2009, 7:57am UTC](https://www.finalbuilder.com/forums/t/how-to-use-variable-within-a-variable/1267/3 "2009-07-21T07:57:23Z")

</div>

Here is my specific solution to this problem (for those interested). This is the Javascript I placed in the If action’s Before script. The LHSValues property appears to hold the left handed side values of the If action.   
  
 Action.LHSValues.Strings(0) = “%CvsCheckoutFull” + FBVariables.ListItem + “%”;   
  
 That seemed to do the trick perfectly.   
  
 The If action resides within a List Iterator action that is iterating over these values: Resources, SourceCode, and Tools. The List Iterator stores the value for the current list item in a variable named ListItem. I created these variables that end up getting checked by the If action: CvsCheckoutFullResources, CvsCheckoutFullSourceCode, CvsCheckoutFullTools. Now, I can set these variables to True of False depending on what I want.   
  
 -Corey
