Hello all,


I have a store with some records and fields that are summed, I use the Sum function to get the total of the field Quantity. Next I need to know the total of the records where a property is set to true. There is one row at this time that meet this filter. I use the query function to retrieve the row(s), but when using the sum function it gives me NaN, using the each function it gives me two records? But the last record is undefined, here some code to explain.

PHP Code:
var quantityTotal ArtStore.sum("Quantity"); //is 500
var FilteredRecords ArtStore.query("field"true);
//FilteredRecords.length = 1
//FilteredRecords.sum("Quantity") = NaN
FilteredRecords.each( function(rec){
   
console.log(rec);
});
//i {phantom: true, internalId: "ext-record-39", raw: Object, data: Object, modified: Object…} 
//undefined 
There is an undefined record in the collection, where does it come from? It screws up the sum function I think.

Thanks!