Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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;