
Hi Chris,
var num must be @all of not @sum of, also you need to parse date[i] to moment() - this should work:
var date = @All of Date of Invoice; // date field in App A
var num = @All of ex VAT Total; // number field in App A
var startFixed = moment("2015/01/01","YYYY/MM/DD").unix(); // start date of time span
var endFixed = moment("2018/12/31","YYYY/MM/DD").unix(); // end date of time span
totalFixed = 0;
for(var i = 0; i < num.length; i++) {
if (moment(date[i]).unix() >= startFixed && moment(date[i]).unix() <= endFixed) {
totalFixed += (num[i] || 0);
}
}
totalFixed ;
Your "ideal" solution (rolling basis) is rather easy to implement. If you use Globiflow it's comfortably too, without Globiflow it's a bit cumbersome.
Rainer