How to sum/calculate with numbers in a sublist matching a condition?

Document created by Matthias_Walter Employee on Sep 15, 2017
Version 1Show Document
  • View in full screen mode

Within skybow rich forms there is a function to easily calculate (sum / average / count / min / max) of sublist numbers.

 

This is taking the value of every row whatever the value is.

But if you want to calculate (e.g. the sum only of numbers bigger than 12), you can use the following function code and loop through the sublist items:

 

 

var total = 0;
var arr = [[@SubLists.Sublist.Number]];
for(var i in arr) {
var number = parseFloat(arr[i].replace(",",""));
if(number > 12) {
total += number;
}
}
return total;

 

Cheers

Matthias

Attachments

    Outcomes