Good Day All
I’m trying to make an HTML child table in Print Format, and I’m facing trouble with the {{loop.index}}
In the HTML, the result is a normal serialized numbers.
{%- for row in doc.child_table -%}
<table width=100% border="1">
<tr>
<td>Sr.</td>
<td>Name</td>
</tr>
<tr>
<td>{{loop.index}}</td>
<td>{{ row.test_name }}</td>
</tr>
</table>
Example:
How can I change the numbers into Alphabet letters ?
Example:
Thank you
@Mohd_RTC21 you can do
{%- for row in doc.child_table -%}
<table width=100% border="1">
<tr>
<td>Sr.</td>
<td>Name</td>
</tr>
<tr>
<td>{{ chr( (64 + loop.index) % 90 ) }}</td>
<td>{{ row.test_name }}</td>
</tr>
</table>
{%- endfor -%}
2 Likes
Thanks for replying @max_morais_dmm
Unfortunately, it doesn’t work
This is the error message:
Traceback (most recent call last):
File "/home/frappe/benches/bench-version-13-2021-12-07/apps/frappe/frappe/utils/jinja.py", line 86, in render_template
return get_jenv().from_string(template).render(context)
File "/home/frappe/benches/bench-version-13-2021-12-07/env/lib/python3.6/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/home/frappe/benches/bench-version-13-2021-12-07/env/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/home/frappe/benches/bench-version-13-2021-12-07/env/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "