Summing multiple levels of calculation fields
Hello,
I am attempting to do several layers of summing. I have an initial app with a quantify field. Items from that app are linked to and summed in another app via a calculation field. Finally, items from the second app are linked to items in a third which should sum using the calculation field from the second app. However, the second/final calculation field is always returning zero rather than summing.
Here's the structure:
Time cards - have a service, start/end time, and a quantity which is a number field
Bill card - have a service, are linked to multiple time cards, and have a calculation field that sums up all the quantity fields of the time cards (this is working)
Stats - are linked to multiple bill cards, and have a calculation field that looks at the bill cards and if they are set to a certain category field, sums those quantities into a single new quantity (this is not working)
I have tried @all of quantity and @sum of quantity and both are returning 0, when I know that the related bill cards have a numerical value in the calculated field.
More confusing, if I recreating the calculation and category field in the bill card and then create a new calculation in the stats to sum it, the previous show the correct number. However, as soon as I save, the number reverts to 0. I think the database has gotten too "messy". However, when I clean up deleted field values, though it SAYS it has completed, the field remain if I go to run the cleanup again.
I have tried several calculations. My first thought was the the output to the bill card calc wasn't a true number and I used this cal:
var ret = 0,
all_of_quantity = Array.prototype.slice.apply(@All of Quantity),
i,
x;
if (@All of Stats Category=="Scan") {
for (i = 0; i < all_of_quantity.length; i += 1) {
ret += all_of_quantity[i];
}
}
ret;
Once I noticed the strange behavior if I recreate, I switched to the much simpler:
if(@All of Type=="Scan"){
@Sum of Total Quantity}else{0}
Any thoughts?
-
HI, see my answer tp your other question here https://help.podio.com/hc/en-us/community/posts/204340057-Calculations-for-category-fields-and-referencing-totals-from-other-apps-?page=1#community_comment_212329808
Please sign in to leave a comment.
Comments
1 comment