How to give serial number in jinja for loop in print format templates

when i give row.index it give (risk_location_and_value)1 like that…when i try to iterate it gives error.
i attached the screenshots below.!


Not sure if either of these will work, but some things to try:
Try using the jinja keyword set, like this:

{% set index = index + 1 %}

Alternatively, you could try using python’s builtin enummerate(), but Frappe has very poor support for standard library functions inside safe_exec. I know that len() isn’t available for example.

1 Like

Thank you @tmatteson for your quick solution. enumerate() works :smile:
but the {% set index = index + 1 %} give one for all the rows.

@BalaV I was just about to reply with a tip about the using the start keyword argument. Glad it worked.

1 Like