ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Display the 1st and 2nd row only in Jinja

Hi Everyone, Hope you can help me with my issue.
Is it possible to show only the 1st and 2nd row on my template?

as of now here’s my code.

        {% for tax in doc.taxes %}
            <tr>
                <td style="color:red;">{{tax.description}} {{ "<b>for IO#: " + tax.tax_io_no + "</b>" if tax.tax_io_no else '' }}</td>
                <td style="position: absolute; left: 504px;"><p class="amountcss">{{ "{:,.2f}".format(tax.tax_amount) }}</p>
                </td>
            </tr>

{%endfor%}

Try accessing the rows by index. For instance, use:
doc.taxes[0]
doc.taxes[1]
Instead of looping thru the the whole taxes list

2 Likes

Try this

1 Like

Thank you for the tip I really appreciate it.

1 Like

Thank you so much @Francisco_Buendia
It works. You’re a life saver.

1 Like