Forum Discussion
QuickBaseJunkie
Qrew Captain
@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
------------------------------
MCAdmin
3 years agoQrew Member
Thank you Sharon for this master piece code on jinga. This worked perfectly. Hats off to you.
I also noticed that the search results from step-D are not sequenced and they come in random order. I would like to fetch the search results orded by a start date in ascending order so I can match with a date from step-A.
Regards
Babi
------------------------------
MC Admin
------------------------------
I also noticed that the search results from step-D are not sequenced and they come in random order. I would like to fetch the search results orded by a start date in ascending order so I can match with a date from step-A.
Regards
Babi
------------------------------
MC Admin
------------------------------
- QuickBaseJunkie3 years agoQrew Captain@MC Admin unfortunately I'm not aware of any way to control the order using the 'native' Quickbase search/query step.
However, if you use the Fetch & Iterate JSON steps with the RESTful API you can create your own query specifying the sort order in the options.
https://developer.quickbase.com/operation/runQuery
This is a much more complex approach and not something I can get into here, but the QB documentation above is pretty good and the Trending Data with Pipelines and the RESTful JSON API video in the university appears to cover these channels.
-Sharon
ā
------------------------------
Quick Base Junkie
------------------------------