0

I'm trying to do something like the following:

 {% for position in positions %}
 {% if position['symbol'] != 'CASH' %}
 <tr>
 <td>{{position['symbol']}}</td>
 <td>{{position['name']}}</td>
 <td>{{position['shares']}}</td>
 <td>{{position['price']}}</td>
 <td>{{position['total']}}</td>
 </tr>
 {% else %}
 {% cash = position['total'] %}
 <tr>
 <td>{{cash}}</td>
 </tr> 
 {% endif %}
 {% endfor %}

Is there a way to capture 'cash' and use it later in the html?

asked Mar 21, 2017 at 16:42
1
  • thanks, did the trick Commented Mar 21, 2017 at 16:46

1 Answer 1

3

try this: {% set variable = cash %}

answered Mar 21, 2017 at 16:43
Sign up to request clarification or add additional context in comments.

1 Comment

Now variable = cash

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.