Expand my Community achievements bar.

Sum fields based on dropdown field

Avatar

Level 3

Hey sorry I haven't touched this in awhile.

I have an expense report and a dropdown for category. I need to then sum the expenses based on that dropdown.

Something like:

If ExpenseDesction[n] ="abc" or "bca" or "cba" then

sum ExpenseAmount(n)

Else

sum ExpenseAmount(n)

Seems super simple.

1 Reply

Avatar

Level 7

I'll give this a shot, but I'm not entirely sure what you're asking.


var amounts = xfa.resolveNodes("tblParts.Row1[*]");


var total = 0;



for (var i=0; i<amounts.length; i++) if (amounts.item(i).ddSomething == "abc") total += amounts.item(i).ExpenseAmount;


//go through the table, if the drop down matches what you're looking for, add that amount to the total



nfExpenseABCTotal.rawValue = total;