mercredi 28 janvier 2015

How to get Total Sum of all entries in a Core Data attribute?

I've got a Core Data Data Model with an Entity and several Attributes.


One of these Attributes is an Integer 16 (NSDecimalNumber) called



numberOfSeconds


I want to find the sum of all the entries I have in my data model from this Attribute.


In other words: I'll have many user entries in this Attribute. Lets say the user creates 3 entries with these specifics:


1) numberOfSeconds = 4


2) numberOfSeconds = 2


3) numberOfSeconds = 5


I'm hoping to be able to grab the total sum which should equal 11.


Appreciate any help in this!




Aucun commentaire:

Enregistrer un commentaire