Advanced [Exercise 4: Dropdown with data from drop] (Training slides exercise)

• Create an input table where name investor, type and amount can be entered
• Show all investors in a dropdown

Solution:

``````{% stripnewlines %}
| Investors name
| Investor type
| Amount
{% newline %}
|------
|------
|------:+
{% newline %}
{% fori investor in custom.investors %}
| {% input investor.name %}
| {% input investor.type %}
| {% =\$3+input investor.value as:currency %}
{% newline %}
{% endfori %}
|
|
|__^^ {{ \$3 | currency }} ^^__
{% endstripnewlines %}
{% for investor in custom.investors %}
{% unless forloop.last %}
{% endunless %}
{% endfor %}
{% input custom.selection.companies as:select options:investor_array %}
``````

Solution using HTML Tables:

``````<table class="usr-width-100">
<tr>
<th class="usr-line-bottom"><b>Investors name</b></th>
<th class="usr-line-bottom"><b>Investor type</b></th>
<th class="usr-line-bottom usr-align-right"><b>Amount</b></th>
</tr>
<tbody>
{% fori investor in custom.investors %}
<tr>
<td class="">{% input investor.name %}</td>
<td class="">{% input investor.type %}</td>
<td class="usr-align-right">{% input investor.value as:currency %}{% assign total_investor_value = total_investor_value+investor.value %}</td>
</tr>
{% endfori %}
<tr>
<td class=""></td>
<td class=""></td>
<td class="usr-double-line-top usr-double-line-bottom usr-align-right">{{ total_investor_value | currency }}</td>
</tr>
</tbody>
</table>

{% for investor in custom.investors %}