Print only first row from table


Is there any way to only print the first row of a child table, even the item table have 2 or more rows?

<table border="1" cellpadding="2" cellspacing="2" style="line-height: 2em;width: 100%;">
			<th style="width:35%">{{ _(&quot;Description&quot;)}}</th>
			<th style="width:35%">{{_(&quot;Picture&quot;)}}</th>
			<th style="width:15%">{{_(&quot;Quantity&quot;)}}</th>
			<th style="width:15%">{{_(&quot;Price&quot;)}}</th>
		<tr>{%- for row in doc.items-%}
			<td>{{ row.item_name}} {{ row.description}}</td>
			<td style="width: 57%;"><img src="{{ row.image }}" style="max-width: 100%" /></td>
			<td>{{ row.qty}}</td>
			<td>{{ row.get_formatted(&quot;rate&quot;, doc) or &#39;&#39;}}</td>
		</tr>{%- endfor -%}


Just a guess, not sure if this will work…

1 Like

No, it didn’t worked

File "<unknown>", line 11, in template
TemplateSyntaxError: expected name or number

Hi, Put this condition.

{{ ("Description")}}

{%- for row in doc.items-%}
{% if loop.index == 1 %}
{{ row.item_name}} {{ row.description}}

{{ row.qty}}
{{ row.get_formatted("rate", doc) or ''}}
{% endif %}
{%- endfor -%}


It works perfectly!

Please make it as solution