Avatar

Level 10

Hi,

If we assume your table row is called itemRow and there is a field called costItem (which can be Yes or No ... should this be a text feild) and a field called amount (that you want to sum up), I would use the following code in the calculate event of the field displaying the result.

var sum = 0;
for (var i=0; i<_itemRow.count; i++)
{
if (itemRow.all.item(i).costItem.rawValue == "Yes")
{
  sum += itemRow.all.item(i).amount.rawValue;
}
}
sum;

Good luck

Bruce