Forum Discussion
I do not have the skills to assist you with the technical Jinja syntax issue but if you don't mind a comment, why don't you just have summary fields to calculate the current item quantity. If you have a relationship where one item has many transactions you can just roll up the ins and outs and have a summary field which represent the running total and that way you have a perfect audit trail with perfect math that will always add up and never be subject to say perhaps a pipeline failure.
Summary fields is what I have settled on. I am managing many compartments in these containers and was afraid there may be a limit on the number of summary fields I can generate between the tables through relationship but if there is I haven't found it yet. I am hoping the number of them wont hurt performance. I think I am still going to be forced to create pipelines to manage related Item information, and other validation rules, but there is a Zen to pipelines and I happen to enjoy them.