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
DCR
15.8k13 gold badges61 silver badges131 bronze badges
-
thanks, did the trickDCR– DCR2017年03月21日 16:46:02 +00:00Commented Mar 21, 2017 at 16:46
1 Answer 1
try this: {% set variable = cash %}
Sign up to request clarification or add additional context in comments.
1 Comment
George
Now variable = cash
default