4

I have store one value in one variable and second in other, now i want to make addition of those two number.I am not able to do that, I have tried below code but its not working

<tr>
    <td>store</td>
    <td>6</td>
    <td>w</td>
</tr>
<tr>
    <td>store</td>
    <td>6</td>
    <td>x</td>
</tr>
<tr>
    <td>store</td>
    <td>javascript{storedVars['w'] + storedVars['x']}</td>
    <td>z</td>
</tr>
<tr>
    <td>echo</td>
    <td>${z}</td>
    <td></td>
</tr>
user1192378
  • 71
  • 1
  • 1
  • 3
  • 3
    Next time you ask a question, "it is not working" is a pretty poor statement of your problem. Consider showing what you get, what error it displays, *etc.* – Ross Patterson Mar 05 '12 at 19:41

2 Answers2

8

You have to use storeEval command

<tr>
    <td>storeEval</td>
    <td>${w}+${x}</td>
    <td>z</td>
</tr>
p0deje
  • 3,903
  • 1
  • 26
  • 37
0

Be sure to add quotes around the variables...

So:

<tr>
    <td>storeEval</td>
    <td>&quot;${w}&quot;+&quot;${x}&quot;</td>
    <td>z</td>
</tr>

You might see some annoying semi-colon related errors if you don't! Cheers!

josh
  • 1