PrashantMaheshw
2 years agoQrew Captain
Re: Pipelines Jinja Sum
HI Shane
Below will work .
A much better explanation is going to come from Others , I will try in my limited Jinja
I'm a Jinja newbie myself , so I'm sure some terminology I've used is wrong to explain
------------------------------
Prashant Maheshwari
------------------------------
Below will work .
A much better explanation is going to come from Others , I will try in my limited Jinja
{% set total = namespace(value=0) %}
{% for r in range(a|length) %}
{% set total.value = total.value + a.value|default(0,true) %}
{% endfor %}
{{ total.value }}
- To iterate through the records you need to find the number of records to sum up , range(a|length) achieves it
- to iterate through the records , you need to refer to each object you've searched , once your loop starts a
will allow you to refer to records/objects individually with loop value so if I have 3 records , it will do a[0] , a[1] , a[2]
I'm a Jinja newbie myself , so I'm sure some terminology I've used is wrong to explain
------------------------------
Prashant Maheshwari
------------------------------