Hello, I have a question pertaining to pipelines and the sum function within jinja2. I have created a pipeline: Step A: searching through records on table 1 for each A do: Step B: Look Up a Reco...
Hey Prashant Maheshwari, I appreciate you and Don Larson's feedback. I tried your approach, but sadly it did not work, I received the same error. I then tried combining yours and Don Larson's suggestion of replacing the look up a record with a search records, it failed once more.
My field in table 1 [paid amount] is a numeric currency field, and my field in table 2 where I am trying to get the summed values to be displayed is also a numeric currency field. Does any of this matter?
Also, you seemed confident in saying this will work, which makes me believe I am doing something wrong. With your example, and with my field that needs to be summed, I would put this in step C (update record) inside the numeric currency field, correct?:
{% set total = namespace(value=0) %}
{% for r in range(a|length) %}
{% set total.value = total.value + a.paid_amount|default(0,true) %}
{% endfor %}
{{ total.value }}
------------------------------ Shane Miller ------------------------------
Wow, thank you so much for taking the time to do all that. That was above and beyond, I really appreciate it. I have tried to recreate your pipeline (tried adjusting the yaml and importing, but was having issues).
I like how you were able to find a workout without using jinja2. If that works, then I am happy. Like yourself, I prefer to stay away from that language. I have uploaded a screenshot of my table 1 and table 2. I am now getting a different error when it tries to update the fields (screenshot). You can see that the records are pulling from the claims for that particular member and showcasing them on table 2. Just not summing them, haha.
Just figured it out. Everything you sent, and what I tried does work, but it will not work if the total amount field is blank. Once I manually changed the total amount field to 0.00 and then ran the pipeline it worked flawlessly. Thank you! Is there code-specific work-around for this? or any other work around that you may recommend?
------------------------------ Shane Miller ------------------------------