# Can the {% for variable in Variables %} help for % and $ expansion in one go?

**URL:** <https://www.finalbuilder.com/forums/t/can-the-for-variable-in-variables-help-for-and-expansion-in-one-go/5320>\
**Category:** Discussion\
**Created:** [February 28, 2015, 8:34am UTC](https://www.finalbuilder.com/forums/t/can-the-for-variable-in-variables-help-for-and-expansion-in-one-go/5320 "2015-02-28T08:34:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeroenp](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/j/c89c15/32.png) [@jeroenp](https://www.finalbuilder.com/forums/u/jeroenp)\
**Post date:** [February 28, 2015, 8:34am UTC](https://www.finalbuilder.com/forums/t/can-the-for-variable-in-variables-help-for-and-expansion-in-one-go/5320/1 "2015-02-28T08:34:48Z")

</div>

Could this help solving the expansion of both % and $ expressions in one go?

`{% ``for` `variable ``in` `Variables %}`

`    ``{% ``if` `variable.Name == ``‘MyAwesomeBuildVariable’` `and variable.Value != ``‘’` `%}`

`        ``My Awesome Build Variable: {{ variable.Value }}`

`    ``{% endif %}`

`{% endfor %}`
  
See&nbsp;[https://plus.google.com/+JeroenPluimers/posts/9WVFCkKD6wq](https://plus.google.com/+JeroenPluimers/posts/9WVFCkKD6wq)  
  
\<\<  
Wish: expansion of both $$ and %% in the same string.  
  
To circumvent this error (where&nbsp;%TargetVersion%=XE2):  
  
Could not expand query ‘$Agent.Delphi.%TargetVersion%.Path$’. Object reference not set to an instance of an object.   
…  
This might be a much simpeler solution: create two new “misc” actions:  
- assign variable expand $$  
- assign variable expand %%  
That way the action flow can determine what do do in which order and ensure the two-stage expansion is done correctly.  
Alternatively, you could make the “expansion” a 5-state one:  
- no expansion  
- $$ expansion  
- %% expansion  
- %% followed by $$ expansion  
- $$ followed by %% expansion  
(from what I observe, I think the final state is what is currently used)   
\>\>

---

<div class="post-metadata">

**Author:** ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)\
**Post date:** [March 2, 2015, 1:02am UTC](https://www.finalbuilder.com/forums/t/can-the-for-variable-in-variables-help-for-and-expansion-in-one-go/5320/2 "2015-03-02T01:02:46Z")

</div>

Hi Jeroen,  
  
I’m not sure exactly what you are asking here?  
  
The expression:  
  
&nbsp;`{% ``for`&nbsp;`variable ``in`&nbsp;`Variables %}`

`    ``{% ``if`&nbsp;`variable.Name == ``‘MyAwesomeBuildVariable’`&nbsp;`and variable.Value != ``‘’`&nbsp;`%}`

`        ``My Awesome Build Variable: {{ variable.Value }}`

`    ``{% endif %}`

`{% endfor %}is valid for use in notification templates to get the value of a variable. The expression $Agent.Delphi.%TargetVersion%.Path$’ does not currently work. We need to do some work on our expression parser to make this work - it’s on our to-do list… `
