Closed zls3201 closed 1 year ago
for example, i want to set pos= pos + field.length
data
{ "fields":[ { "name":"number_field", "length":1 }, { "name":"text_field", "length":2 }, { "name":"validate", "length":3 } ] }
template
{% assign pos = 0 -%} {% for field in fields %} {{ field.name }} length: {{ field.length }} [{{ pos }}, {{ field.length | plus: pos | plus: -1 }}] {% # pos= pos + field.length %} ..... {% endfor %}
Try this:
{% assign pos = pos | plus: field.length %}
for example, i want to set pos= pos + field.length
data
template