QuickBaseJunkie
Qrew Legend
4 years agoRe: Pipeline Jinja template expression
@MC Admin You are on the right track.
If your ā'no_of_days' attribute/field is required and will not have any null values you can use this approach:
However, if there may be null values in the 'no_of_days' field a different approach is necessary.
The above creates a 'total' variable with an initial value of 0. Then loops through the records found in Step D adding them together, while setting a default value of 0 if null. Then it evaluates it against the value of 100 for the condition.
To learn more about using Jinja in Pipelines I suggest taking the "Intro to Jinja for Pipelines" course. It includes a Library of Jinja references for Pipelines including approaches such as this. https://www.quickbasejunkie.com/intro-to-jinja
Let me know if this works and what approach ended up doing the job. š
-Sharon
------------------------------
Quick Base Junkie
------------------------------
If your ā'no_of_days' attribute/field is required and will not have any null values you can use this approach:
{{ (d|sum(attribute='no_of_days')) >= 100 }}
However, if there may be null values in the 'no_of_days' field a different approach is necessary.
{% set total = namespace(value=0) %}
{% for r in d %}
{% set total.value = total.value + (r.no_of_days|default(0, true)) %} {% endfor %}
{{ total.value >= 100 }}
The above creates a 'total' variable with an initial value of 0. Then loops through the records found in Step D adding them together, while setting a default value of 0 if null. Then it evaluates it against the value of 100 for the condition.
To learn more about using Jinja in Pipelines I suggest taking the "Intro to Jinja for Pipelines" course. It includes a Library of Jinja references for Pipelines including approaches such as this. https://www.quickbasejunkie.com/intro-to-jinja
Let me know if this works and what approach ended up doing the job. š
-Sharon
------------------------------
Quick Base Junkie
------------------------------